Class: Grubby::JsonParser

Inherits:
Mechanize::File
  • Object
show all
Defined in:
lib/grubby/json_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri = nil, response = nil, body = nil, code = nil, mech = nil) ⇒ JsonParser

Returns a new instance of JsonParser.



13
14
15
16
17
# File 'lib/grubby/json_parser.rb', line 13

def initialize(uri = nil, response = nil, body = nil, code = nil, mech = nil)
  @json = JSON.load(body, nil, create_additions: false)
  @mech = mech
  super(uri, response, body, code)
end

Instance Attribute Details

#jsonHash, Array (readonly)

The parsed JSON data.

Returns:

  • (Hash, Array)


6
7
8
# File 'lib/grubby/json_parser.rb', line 6

def json
  @json
end

#mechMechanize?

The Mechanize agent used to make the request.

Returns:

  • (Mechanize, nil)


11
12
13
# File 'lib/grubby/json_parser.rb', line 11

def mech
  @mech
end