Module: Yfinrb::Fundamentals
Class Method Summary collapse
-
.included(base) ⇒ Object
built-in Ruby hook for modules.
Instance Method Summary collapse
-
#earnings ⇒ Object
delegate :proxy, :tz, to: :ticker.
- #initialize_fundamentals ⇒ Object
- #shares ⇒ Object
Class Method Details
.included(base) ⇒ Object
built-in Ruby hook for modules
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/yfinrb/fundamentals.rb', line 5 def self.included(base) # built-in Ruby hook for modules base.class_eval do attr_reader :financials, :earnings, :shares, :ticker original_method = instance_method(:initialize) define_method(:initialize) do |*args, &block| original_method.bind(self).call(*args, &block) initialize_fundamentals # (your module code here) end end end |
Instance Method Details
#earnings ⇒ Object
delegate :proxy, :tz, to: :ticker
29 30 31 32 |
# File 'lib/yfinrb/fundamentals.rb', line 29 def earnings raise YFNotImplementedError.new('earnings') if @earnings.nil? @earnings end |
#initialize_fundamentals ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/yfinrb/fundamentals.rb', line 17 def initialize_fundamentals @earnings = nil @financials = nil @shares = nil @financials_data = nil @fin_data_quote = nil @basics_already_scraped = false end |
#shares ⇒ Object
34 35 36 37 |
# File 'lib/yfinrb/fundamentals.rb', line 34 def shares raise YFNotImplementedError.new('shares') if @shares.nil? @shares end |