Sha256: 16bb500f6ab4bdf22ca31ba33049e8905c4a1f71517a2c6d191f123b635e018e
Contents?: true
Size: 875 Bytes
Versions: 17
Compression:
Stored size: 875 Bytes
Contents
# frozen_string_literal: true ## # 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 class Mechanize::FileSaver < Mechanize::Download attr_reader :filename def initialize uri = nil, response = nil, body_io = nil, code = nil @full_path = true super save @filename end ## # The save_as alias is provided for backwards compatibility with mechanize # 2.0. It will be removed in mechanize 3. #-- # TODO remove in mechanize 3 alias save_as save end
Version data entries
17 entries across 17 versions & 1 rubygems