Class: Grubby::JsonScraper

Inherits:
Scraper
  • Object
show all
Defined in:
lib/grubby/json_scraper.rb

Instance Attribute Summary collapse

Attributes inherited from Scraper

#source

Instance Method Summary collapse

Methods inherited from Scraper

#[], fields, scrapes, #to_h

Constructor Details

#initialize(source) ⇒ JsonScraper

Returns a new instance of JsonScraper.

Parameters:



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

def initialize(source)
  @json = source.assert_kind_of!(Grubby::JsonParser).json
  super
end

Instance Attribute Details

#jsonHash, Array (readonly)

Returns The parsed JSON data being scraped.

Returns:

  • (Hash, Array)

    The parsed JSON data being scraped.



5
6
7
# File 'lib/grubby/json_scraper.rb', line 5

def json
  @json
end