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.



15
16
17
18
19
# File 'lib/grubby/json_parser.rb', line 15

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)


8
9
10
# File 'lib/grubby/json_parser.rb', line 8

def json
  @json
end

#mechMechanize?

The Mechanize agent used to make the request.

Returns:

  • (Mechanize, nil)


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

def mech
  @mech
end