Class: Pennyworth::Loaders::HTMX
- Inherits:
-
Object
- Object
- Pennyworth::Loaders::HTMX
- Defined in:
- lib/pennyworth/loaders/htmx.rb
Overview
Loads htmx records by scraping web page.
Instance Method Summary collapse
- #call(uri) ⇒ Object
-
#initialize(parser: Nokogiri::HTML5, model: Models::HTMX) ⇒ HTMX
constructor
A new instance of HTMX.
Constructor Details
Instance Method Details
#call(uri) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/pennyworth/loaders/htmx.rb', line 18 def call uri fetch(uri).then { parse_rows it } .each .with_object [] do |row, entries| row.children in Nokogiri::XML::Element => item, Nokogiri::XML::Element => description entries.append build_record(item, description) unless item.text.include? "Soon" end end |