Class: Craig::Page
- Inherits:
-
Object
- Object
- Craig::Page
- Defined in:
- lib/craig/page.rb
Overview
Represents a page of listings.
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#dom ⇒ Object
readonly
Returns the value of attribute dom.
-
#subcategory ⇒ Object
readonly
Returns the value of attribute subcategory.
Instance Method Summary collapse
-
#initialize(category, subcategory, dom) ⇒ Page
constructor
A new instance of Page.
- #listings ⇒ Array<Craig::Listing>
Constructor Details
#initialize(category, subcategory, dom) ⇒ Page
Returns a new instance of Page.
7 8 9 10 11 |
# File 'lib/craig/page.rb', line 7 def initialize(category, subcategory, dom) @category = category @subcategory = subcategory @dom = dom end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
5 6 7 |
# File 'lib/craig/page.rb', line 5 def category @category end |
#dom ⇒ Object (readonly)
Returns the value of attribute dom.
5 6 7 |
# File 'lib/craig/page.rb', line 5 def dom @dom end |
#subcategory ⇒ Object (readonly)
Returns the value of attribute subcategory.
5 6 7 |
# File 'lib/craig/page.rb', line 5 def subcategory @subcategory end |
Instance Method Details
#listings ⇒ Array<Craig::Listing>
14 15 16 17 18 |
# File 'lib/craig/page.rb', line 14 def listings dom.css("#toc_rows .row").map do |node| listing_const.new(node) end end |