Method: Mechanize::Download#initialize
- Defined in:
- lib/mechanize/download.rb
#initialize(uri = nil, response = nil, body_io = nil, code = nil) {|_self| ... } ⇒ Download
Creates a new download retrieved from the given uri and response object. The body_io is an IO-like containing the HTTP response body and code is the HTTP status.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mechanize/download.rb', line 31 def initialize uri = nil, response = nil, body_io = nil, code = nil @uri = uri @body_io = body_io @code = code @full_path = false unless defined? @full_path fill_header response extract_filename yield self if block_given? end |