Method: FinModeling::AssetsCalculation#summary

Defined in:
lib/finmodeling/assets_calculation.rb

#summary(args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/finmodeling/assets_calculation.rb', line 15

def summary(args)
  summary_cache_key = args[:period].to_pretty_s
  thesummary = lookup_cached_summary(summary_cache_key)
  return thesummary if !thesummary.nil?

  thesummary = super(:period => args[:period], :mapping => mapping)
  if !lookup_cached_classifications(BASE_FILENAME, thesummary.rows)
    lookahead = [4, thesummary.rows.length-1].min
    classify_rows(ALL_STATES, NEXT_STATES, thesummary.rows, FinModeling::AssetsItem, lookahead)
    save_cached_classifications(BASE_FILENAME, thesummary.rows)
  end

  save_cached_summary(summary_cache_key, thesummary)

  return thesummary
end