Class: Weneedfeed::Page
- Inherits:
-
Object
- Object
- Weneedfeed::Page
- Defined in:
- lib/weneedfeed/page.rb
Instance Attribute Summary collapse
- #description ⇒ String? readonly
- #title ⇒ String readonly
- #url ⇒ String readonly
Instance Method Summary collapse
-
#initialize(description:, item_description_selector:, item_image_selector:, item_link_selector:, item_time_selector:, item_title_selector:, item_selector:, node:, title:, url:) ⇒ Page
constructor
A new instance of Page.
- #items ⇒ Array<Weneedfeed::Item>
Constructor Details
#initialize(description:, item_description_selector:, item_image_selector:, item_link_selector:, item_time_selector:, item_title_selector:, item_selector:, node:, title:, url:) ⇒ Page
Returns a new instance of Page.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/weneedfeed/page.rb', line 24 def initialize( description:, item_description_selector:, item_image_selector:, item_link_selector:, item_time_selector:, item_title_selector:, item_selector:, node:, title:, url: ) @description = description @item_description_selector = item_description_selector @item_image_selector = item_image_selector @item_link_selector = item_link_selector @item_time_selector = item_time_selector @item_title_selector = item_title_selector @item_selector = item_selector @node = node @title = title @url = url end |
Instance Attribute Details
#description ⇒ String? (readonly)
6 7 8 |
# File 'lib/weneedfeed/page.rb', line 6 def description @description end |
#title ⇒ String (readonly)
9 10 11 |
# File 'lib/weneedfeed/page.rb', line 9 def title @title end |
#url ⇒ String (readonly)
12 13 14 |
# File 'lib/weneedfeed/page.rb', line 12 def url @url end |
Instance Method Details
#items ⇒ Array<Weneedfeed::Item>
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/weneedfeed/page.rb', line 49 def items @node.search(@item_selector).map do |node| ::Weneedfeed::Item.new( description_selector: @item_description_selector, image_selector: @item_image_selector, link_selector: @item_link_selector, node: node, time_selector: @item_time_selector, title_selector: @item_title_selector, url: @url ) end end |