Class: NibblerJSON

Inherits:
Object
  • Object
show all
Extended by:
NibblerMethods
Defined in:
lib/nibbler/json.rb

Overview

a scraper that works with JsonDocument

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NibblerMethods

element, elements, extended, parse, rules

Constructor Details

#initialize(doc, parent = nil) ⇒ NibblerJSON

Returns a new instance of NibblerJSON.



93
94
95
96
# File 'lib/nibbler/json.rb', line 93

def initialize(doc, parent = nil)
  doc = Nibbler::JsonDocument.new(doc, parent && parent.doc.root) unless doc.respond_to? :search
  super(doc)
end

Class Method Details

.parse(data, parent = nil) ⇒ Object



89
90
91
# File 'lib/nibbler/json.rb', line 89

def self.parse(data, parent = nil)
  new(data, parent).parse
end