Module: Yfinrb::Fundamentals

Extended by:
ActiveSupport::Concern
Included in:
Ticker
Defined in:
lib/yfinrb/fundamentals.rb

Class Method Summary collapse

Instance Method Summary collapse

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

#earningsObject

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_fundamentalsObject



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

#sharesObject



34
35
36
37
# File 'lib/yfinrb/fundamentals.rb', line 34

def shares
  raise YFNotImplementedError.new('shares') if @shares.nil?
  @shares
end