Class: FinModeling::CashChangeSummaryFromDifferences

Inherits:
Object
  • Object
show all
Defined in:
lib/finmodeling/cash_change_summary_from_differences.rb

Instance Method Summary collapse

Constructor Details

#initialize(re_cfs1, re_cfs2) ⇒ CashChangeSummaryFromDifferences

Returns a new instance of CashChangeSummaryFromDifferences.



3
4
5
6
# File 'lib/finmodeling/cash_change_summary_from_differences.rb', line 3

def initialize(re_cfs1, re_cfs2)
  @re_cfs1 = re_cfs1
  @re_cfs2 = re_cfs2
end

Instance Method Details

#filter_by_type(key) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/finmodeling/cash_change_summary_from_differences.rb', line 7

def filter_by_type(key)
  case key
    when :c
      @cs = FinModeling::CalculationSummary.new
      @cs.title = "Cash from Operations"
      @cs.rows = [ CalculationRow.new(:key => "First  Row", :vals => [ @re_cfs1.cash_from_operations.total] ),
                   CalculationRow.new(:key => "Second Row", :vals => [-@re_cfs2.cash_from_operations.total] ) ]
      return @cs
    when :i
      @cs = FinModeling::CalculationSummary.new
      @cs.title = "Cash Investments in Operations"
      @cs.rows = [ CalculationRow.new(:key => "First  Row", :vals => [ @re_cfs1.cash_investments_in_operations.total] ),
                   CalculationRow.new(:key => "Second Row", :vals => [-@re_cfs2.cash_investments_in_operations.total] ) ]
      return @cs
    when :d
      @cs = FinModeling::CalculationSummary.new
      @cs.title = "Payments to Debtholders"
      @cs.rows = [ CalculationRow.new(:key => "First  Row", :vals => [ @re_cfs1.payments_to_debtholders.total] ),
                   CalculationRow.new(:key => "Second Row", :vals => [-@re_cfs2.payments_to_debtholders.total] ) ]
      return @cs
    when :f
      @cs = FinModeling::CalculationSummary.new
      @cs.title = "Payments to Stockholders"
      @cs.rows = [ CalculationRow.new(:key => "First  Row", :vals => [ @re_cfs1.payments_to_stockholders.total] ),
                   CalculationRow.new(:key => "Second Row", :vals => [-@re_cfs2.payments_to_stockholders.total] ) ]
      return @cs
  end
end