Class: Scraping::Rules::Sections
- Defined in:
- lib/scraping/rules/sections.rb
Instance Attribute Summary collapse
-
#multiselector ⇒ Object
readonly
Returns the value of attribute multiselector.
Attributes inherited from Section
Instance Method Summary collapse
- #call(scraper, node) ⇒ Object
-
#initialize(name, selector) ⇒ Sections
constructor
A new instance of Sections.
Methods inherited from Section
Methods included from DSL
#element, #elements, #rules, #section, #sections
Constructor Details
#initialize(name, selector) ⇒ Sections
Returns a new instance of Sections.
8 9 10 11 |
# File 'lib/scraping/rules/sections.rb', line 8 def initialize(name, selector) super name, '.' @multiselector = selector end |
Instance Attribute Details
#multiselector ⇒ Object (readonly)
Returns the value of attribute multiselector.
6 7 8 |
# File 'lib/scraping/rules/sections.rb', line 6 def multiselector @multiselector end |
Instance Method Details
#call(scraper, node) ⇒ Object
13 14 15 16 17 |
# File 'lib/scraping/rules/sections.rb', line 13 def call(scraper, node) node.search(multiselector).map do |item| super scraper, item end end |