Class: FinModeling::CashFlowStatementCalculation
Constant Summary
collapse
- CASH_GOAL =
"cash change"
- CASH_LABELS =
[ /^cash and cash equivalents period increase decrease/,
/^(|net )(change|increase|decrease|decrease *increase|increase *decrease) in cash and(| cash) equivalents/,
/^net cash provided by used in (|operating activities )continuing operations/,
/^net cash provided by used in operating activities/]
- CASH_ANTI_LABELS =
[ ]
- CASH_IDS =
[ /^(|Locator_|loc_)(|us-gaap_)CashAndCashEquivalentsPeriodIncreaseDecrease[_a-z0-9]+/,
/^(|Locator_|loc_)(|us-gaap_)NetCashProvidedByUsedIn(|OperatingActivities)ContinuingOperations[_a-z0-9]+/ ]
Instance Attribute Summary
#calculation
Instance Method Summary
collapse
#initialize, #label, #leaf_items, #leaf_items_sum, #periods, #summary
Instance Method Details
#cash_change_calculation ⇒ Object
#is_valid? ⇒ Boolean
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/finmodeling/cash_flow_statement_calculation.rb', line 18
def is_valid?
re_cfs = reformulated(periods.last)
flows_are_balanced = (re_cfs.free_cash_flow.total == (-1*re_cfs.financing_flows.total))
puts "flows are not balanced" if !flows_are_balanced
none_are_zero = (re_cfs.cash_from_operations.total != 0) &&
(re_cfs.cash_investments_in_operations.total != 0) &&
(re_cfs.payments_to_debtholders.total != 0) puts "(re_cfs.cash_from_operations.total == 0)" if (re_cfs.cash_from_operations.total == 0)
puts "(re_cfs.cash_investments_in_operations.total == 0)" if (re_cfs.cash_investments_in_operations.total == 0)
puts "(re_cfs.payments_to_debtholders.total == 0)" if (re_cfs.payments_to_debtholders.total == 0)
return (flows_are_balanced && none_are_zero)
end
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/finmodeling/cash_flow_statement_calculation.rb', line 37
def latest_quarterly_reformulated(prev_cfs)
if cash_change_calculation.periods.quarterly.any?
period = cash_change_calculation.periods.quarterly.last
lqr = reformulated(period)
return lqr if lqr.flows_are_plausible?
end
return nil if !prev_cfs
cur_period, prev_period = choose_successive_periods(cash_change_calculation, prev_cfs.cash_change_calculation)
if cur_period && prev_period
return reformulated(cur_period) - prev_cfs.reformulated(prev_period)
end
return nil
end
|
33
34
35
|
# File 'lib/finmodeling/cash_flow_statement_calculation.rb', line 33
def reformulated(period)
return ReformulatedCashFlowStatement.new(period, cash_change_calculation.summary(:period => period))
end
|
#write_constructor(file, item_name) ⇒ Object
54
55
56
57
58
|
# File 'lib/finmodeling/cash_flow_statement_calculation.rb', line 54
def write_constructor(file, item_name)
item_calc_name = item_name + "_calc"
@calculation.write_constructor(file, item_calc_name)
file.puts "#{item_name} = FinModeling::CashFlowStatementCalculation.new(#{item_calc_name})"
end
|