Method: Mechanize::File#initialize

Defined in:
lib/mechanize/file.rb

#initialize(uri = nil, response = nil, body = nil, code = nil) {|_self| ... } ⇒ File

Creates a new file retrieved from the given uri and response object. The body is the HTTP response body and code is the HTTP status.

Yields:

  • (_self)

Yield Parameters:



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/mechanize/file.rb', line 39

def initialize uri = nil, response = nil, body = nil, code = nil
  @uri  = uri
  @body = body
  @code = code

  @full_path = false unless defined? @full_path

  fill_header response
  extract_filename

  yield self if block_given?
end