Class: Nibbler
Overview
An HTML/XML scraper
Direct Known Subclasses
Defined Under Namespace
Classes: JsonDocument
Instance Method Summary collapse
-
#initialize(doc) ⇒ Nibbler
constructor
Parse data with Nokogiri unless it’s already an acceptable document.
Methods included from NibblerMethods
element, elements, extended, parse, rules
Constructor Details
#initialize(doc) ⇒ Nibbler
Parse data with Nokogiri unless it’s already an acceptable document
111 112 113 114 115 116 117 |
# File 'lib/nibbler.rb', line 111 def initialize(doc) unless doc.respond_to?(:at) and doc.respond_to?(:search) require 'nokogiri' unless defined? ::Nokogiri doc = Nokogiri doc end super(doc) end |