Class: Finviz::Quotes
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Finviz::Quotes
- Defined in:
- lib/finviz/quotes.rb
Overview
The result of the quotes request
Instance Method Summary collapse
Instance Method Details
#add_quote_from_xpath(ticker_xpath, table_xpath) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/finviz/quotes.rb', line 6 def add_quote_from_xpath(ticker_xpath, table_xpath) ticker = ticker_xpath.children.text.downcase stats = table_xpath .css(".table-dark-row") .map { |row| row.css("td").map(&:text) } .flatten .each_slice(2) self[ticker] = Quote.new ticker: ticker, stats: stats end |
#to_h ⇒ Object
16 17 18 |
# File 'lib/finviz/quotes.rb', line 16 def to_h super.transform_values(&:to_h) end |