Class: FinModeling::QuarterlyReportFiling

Inherits:
AnnualReportFiling show all
Defined in:
lib/finmodeling/quarterly_report_filing.rb

Constant Summary

Constants inherited from AnnualReportFiling

AnnualReportFiling::CONSTRUCTOR_PATH, AnnualReportFiling::CURRENT_SCHEMA_VERSION, AnnualReportFiling::SCHEMA_VERSION_ITEM

Constants inherited from CompanyFiling

CompanyFiling::DOWNLOAD_PATH

Instance Attribute Summary

Attributes inherited from CompanyFiling

#instance

Instance Method Summary collapse

Methods inherited from AnnualReportFiling

#balance_sheet, #cash_flow_statement, #comprehensive_income_statement, download, #has_a_comprehensive_income_statement?, #has_a_shareholder_equity_statement?, #has_an_income_statement?, #income_statement, #is_valid?, #shareholder_equity_statement

Methods inherited from CompanyFiling

#disclosures, download, #initialize, #print_calculations, #print_presentations

Constructor Details

This class inherits a constructor from FinModeling::CompanyFiling

Instance Method Details

#write_constructor(file, item_name) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/finmodeling/quarterly_report_filing.rb', line 4

def write_constructor(file, item_name)
  balance_sheet                 .write_constructor(file, bs_name  = item_name + "_bs" )
  income_statement              .write_constructor(file, is_name  = item_name + "_is" ) if has_an_income_statement?
  comprehensive_income_statement.write_constructor(file, cis_name = item_name + "_cis") if has_a_comprehensive_income_statement?
  cash_flow_statement           .write_constructor(file, cfs_name = item_name + "_cfs")

  is_name  = "nil" if !has_an_income_statement?
  cis_name = "nil" if !has_a_comprehensive_income_statement?
  ses_name = "nil" # because these only get reported in 10-k's?

  names_of_discs = []
  disclosures.each_with_index do |disclosure, idx|
    name_of_disc = item_name + "_disc#{idx}"
    disclosure.write_constructor(file, name_of_disc)
    names_of_discs << name_of_disc
  end
  names_of_discs_str = "[" + names_of_discs.join(',') + "]"

  file.puts "#{SCHEMA_VERSION_ITEM} = #{CURRENT_SCHEMA_VERSION}"

  file.puts "#{item_name} = FinModeling::CachedQuarterlyFiling.new(#{bs_name}, #{is_name}, #{cis_name}, #{cfs_name}, #{ses_name}, #{names_of_discs_str})"
end