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
#initialize(parser: Nokogiri::HTML5, model: Models::HTMX) ⇒ HTMX
Returns a new instance of HTMX.
12 13 14 15 16 |
# File 'lib/pennyworth/loaders/htmx.rb', line 12 def initialize(parser: Nokogiri::HTML5, model: Models::HTMX, **) @parser = parser @model = model super(**) end |
Instance Method Details
#call(uri) ⇒ Object
18 19 20 21 22 |
# File 'lib/pennyworth/loaders/htmx.rb', line 18 def call uri fetch(uri).then { parse_rows it } .each .with_object([]) { |row, entries| entries.append parse_elements(row.children) } end |