Class: LiteXBRL::TDnet::ResultsForecast2

Inherits:
FinancialInformation2 show all
Includes:
ResultsForecastAttribute
Defined in:
lib/litexbrl/tdnet/results_forecast2.rb

Constant Summary

Constants inherited from FinancialInformation2

FinancialInformation2::SEASON_Q1, FinancialInformation2::SEASON_Q2, FinancialInformation2::SEASON_Q3, FinancialInformation2::SEASON_Q4

Constants included from AccountItem

AccountItem::CHANGE_FORECAST_NET_INCOME, AccountItem::CHANGE_FORECAST_NET_SALES, AccountItem::CHANGE_FORECAST_OPERATING_INCOME, AccountItem::CHANGE_FORECAST_ORDINARY_INCOME, AccountItem::CHANGE_IN_NET_INCOME, AccountItem::CHANGE_IN_NET_SALES, AccountItem::CHANGE_IN_OPERATING_INCOME, AccountItem::CHANGE_IN_ORDINARY_INCOME, AccountItem::CHANGE_NET_INCOME, AccountItem::CHANGE_NET_SALES, AccountItem::CHANGE_OPERATING_INCOME, AccountItem::CHANGE_ORDINARY_INCOME, AccountItem::COMPANY_NAME, AccountItem::FORECAST_NET_INCOME, AccountItem::FORECAST_NET_INCOME_PER_SHARE, AccountItem::FORECAST_NET_SALES, AccountItem::FORECAST_OPERATING_INCOME, AccountItem::FORECAST_ORDINARY_INCOME, AccountItem::NET_INCOME, AccountItem::NET_INCOME_PER_SHARE, AccountItem::NET_SALES, AccountItem::OPERATING_INCOME, AccountItem::ORDINARY_INCOME, AccountItem::PREVIOUS_FORECAST_NET_INCOME, AccountItem::PREVIOUS_FORECAST_NET_INCOME_PER_SHARE, AccountItem::PREVIOUS_FORECAST_NET_SALES, AccountItem::PREVIOUS_FORECAST_OPERATING_INCOME, AccountItem::PREVIOUS_FORECAST_ORDINARY_INCOME

Instance Attribute Summary

Attributes included from ResultsForecastAttribute

#change_forecast_net_income, #change_forecast_net_sales, #change_forecast_operating_income, #change_forecast_ordinary_income, #code, #forecast_net_income, #forecast_net_income_per_share, #forecast_net_sales, #forecast_operating_income, #forecast_ordinary_income, #month, #previous_forecast_net_income, #previous_forecast_net_income_per_share, #previous_forecast_net_sales, #previous_forecast_operating_income, #previous_forecast_ordinary_income, #quarter, #year

Class Method Summary collapse

Methods included from ResultsForecastAttribute

#attributes

Methods included from Utils

#hash_with_default, #percent_to_f, #present?, #to_f, #to_i, #to_mill, #to_month, #to_securities_code, #to_year

Methods included from AccountItem

define_item, define_nested_item

Class Method Details

.read(doc) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/litexbrl/tdnet/results_forecast2.rb', line 6

def self.read(doc)
  xbrl_q2 = read_data doc, SEASON_Q2
  xbrl_q4 = read_data doc, SEASON_Q4

  unless xbrl_q2 || xbrl_q4
    xbrl_q1 = read_data doc, SEASON_Q1
    xbrl_q3 = read_data doc, SEASON_Q3 unless xbrl_q1

    raise StandardError.new "業績予想の修正を取得できません。" unless xbrl_q1 || xbrl_q3
  end

  data = {results_forecast: []}
  data[:results_forecast] << xbrl_q1.attributes if xbrl_q1
  data[:results_forecast] << xbrl_q2.attributes if xbrl_q2
  data[:results_forecast] << xbrl_q3.attributes if xbrl_q3
  data[:results_forecast] << xbrl_q4.attributes if xbrl_q4

  data
end