File: file_saver.rb [mechanize-2.7.2 Documentation]

Last Modified
  2014-03-27 02:38:46 +0000
Requires

## Description

This is a pluggable parser that automatically saves every file it encounters. Unlike Mechanize::DirectorySaver, the file saver saves the responses as a tree, reflecting the host and file path.

## Example

This example saves all .pdf files

    require 'mechanize'

    agent = Mechanize.new
    agent.pluggable_parser.pdf = Mechanize::FileSaver
    agent.get 'http://example.com/foo.pdf'

    Dir['example.com/*'] # => foo.pdf