Class: YahooStock::History
Defined Under Namespace
Classes: HistoryError
Instance Method Summary collapse
- #data_attributes ⇒ Object
- #find ⇒ Object
-
#initialize(options) ⇒ History
constructor
A new instance of History.
- #values_with_header ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(options) ⇒ History
Returns a new instance of History.
6 7 8 9 10 11 |
# File 'lib/yahoo_stock/history.rb', line 6 def initialize() unless .is_a?(Hash) raise HistoryError, 'A hash of start_date, end_date and stock_symbol is expected as parameters' end @interface = YahooStock::Interface::History.new() end |
Instance Method Details
#data_attributes ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/yahoo_stock/history.rb', line 22 def data_attributes return unless values_with_header data_attributes = /Date.*\s/.match(values_with_header) unless data_attributes.nil? @data_attributes = data_attributes[0].sub(/\s*$/,'').split(',') @data_attributes.map &:strip end end |
#find ⇒ Object
13 14 15 16 |
# File 'lib/yahoo_stock/history.rb', line 13 def find @find_values = super() @find_values.sub(/Date.*\s/,'') if @find_values end |
#values_with_header ⇒ Object
18 19 20 |
# File 'lib/yahoo_stock/history.rb', line 18 def values_with_header @interface.values end |