class LiteXBRL::TDnet::ResultsForecast
Constants
- SEASON_Q2
- SEASON_Q4
Public Class Methods
read(doc)
click to toggle source
# File lib/litexbrl/tdnet/results_forecast.rb, line 9 def self.read(doc) xbrl_q2 = read_data doc, SEASON_Q2 xbrl_q4 = read_data doc, SEASON_Q4 raise StandardError.new "業績予想の修正を取得できません。" unless xbrl_q2 || xbrl_q4 data = {results_forecast: []} data[:results_forecast] << xbrl_q2.attributes if xbrl_q2 data[:results_forecast] << xbrl_q4.attributes if xbrl_q4 data end
Private Class Methods
find_base_data(doc, season)
click to toggle source
# File lib/litexbrl/tdnet/results_forecast.rb, line 30 def self.find_base_data(doc, season) # TODO 先に連結のみ試す? consolidation = find_consolidation(doc, season, FORECAST_NET_SALES) consolidation = find_consolidation(doc, season, FORECAST_OPERATING_INCOME) unless consolidation consolidation = find_consolidation(doc, season, FORECAST_ORDINARY_INCOME) unless consolidation consolidation = find_consolidation(doc, season, FORECAST_NET_INCOME) unless consolidation consolidation = find_consolidation(doc, season, FORECAST_NET_INCOME_PER_SHARE) unless consolidation consolidation = find_consolidation_prev(doc, season, PREVIOUS_FORECAST_NET_SALES) unless consolidation consolidation = find_consolidation_prev(doc, season, PREVIOUS_FORECAST_OPERATING_INCOME) unless consolidation consolidation = find_consolidation_prev(doc, season, PREVIOUS_FORECAST_ORDINARY_INCOME) unless consolidation consolidation = find_consolidation_prev(doc, season, PREVIOUS_FORECAST_NET_INCOME) unless consolidation consolidation = find_consolidation_prev(doc, season, PREVIOUS_FORECAST_NET_INCOME_PER_SHARE) unless consolidation consolidation_base_data = FinancialInformation.send(:find_consolidation, doc) consolidation = consolidation_base_data unless consolidation context = context_hash(consolidation, season) xbrl = new # 証券コード xbrl.code = find_securities_code(doc, consolidation_base_data) # 決算年 xbrl.year = find_year(doc, consolidation_base_data) # 決算月 xbrl.month = find_month(doc, consolidation_base_data) # 四半期 xbrl.quarter = season == SEASON_Q2 ? 2 : 4 # 連結・非連結 xbrl.consolidation = to_consolidation(consolidation) return xbrl, context end
find_consolidation(doc, season, item)
click to toggle source
連結・非連結を取得します
# File lib/litexbrl/tdnet/results_forecast.rb, line 67 def self.find_consolidation(doc, season, item) cons = present? find_value_tse_t_ed(doc, item, "Current#{season}ConsolidatedDuration") non_cons = present? find_value_tse_t_ed(doc, item, "Current#{season}NonConsolidatedDuration") if cons "Consolidated" elsif non_cons "NonConsolidated" end end
find_consolidation_prev(doc, season, item)
click to toggle source
連結・非連結を取得します
# File lib/litexbrl/tdnet/results_forecast.rb, line 81 def self.find_consolidation_prev(doc, season, item) cons = present? find_value_tse_t_rv(doc, item, "Current#{season}ConsolidatedDuration") non_cons = present? find_value_tse_t_rv(doc, item, "Current#{season}NonConsolidatedDuration") if cons "Consolidated" elsif non_cons "NonConsolidated" end end
find_data(doc, xbrl, context)
click to toggle source
# File lib/litexbrl/tdnet/results_forecast.rb, line 92 def self.find_data(doc, xbrl, context) # 通期/第2四半期予想売上高 xbrl.forecast_net_sales = to_mill find_value_ed(doc, FORECAST_NET_SALES, context) # 通期/第2四半期予想営業利益 xbrl.forecast_operating_income = to_mill find_value_ed(doc, FORECAST_OPERATING_INCOME, context) # 通期/第2四半期予想経常利益 xbrl.forecast_ordinary_income = to_mill find_value_ed(doc, FORECAST_ORDINARY_INCOME, context) # 通期/第2四半期予想純利益 xbrl.forecast_net_income = to_mill find_value_ed(doc, FORECAST_NET_INCOME, context) # 通期/第2四半期予想1株当たり純利益 xbrl.forecast_net_income_per_share = to_f find_value_ed(doc, FORECAST_NET_INCOME_PER_SHARE, context) # 修正前通期/第2四半期予想売上高 xbrl.previous_forecast_net_sales = to_mill find_value_rv(doc, PREVIOUS_FORECAST_NET_SALES, context) # 修正前通期/第2四半期予想営業利益 xbrl.previous_forecast_operating_income = to_mill find_value_rv(doc, PREVIOUS_FORECAST_OPERATING_INCOME, context) # 修正前通期/第2四半期予想経常利益 xbrl.previous_forecast_ordinary_income = to_mill find_value_rv(doc, PREVIOUS_FORECAST_ORDINARY_INCOME, context) # 修正前通期/第2四半期予想純利益 xbrl.previous_forecast_net_income = to_mill find_value_rv(doc, PREVIOUS_FORECAST_NET_INCOME, context) # 修正前通期/第2四半期予想1株当たり純利益 xbrl.previous_forecast_net_income_per_share = to_f find_value_rv(doc, PREVIOUS_FORECAST_NET_INCOME_PER_SHARE, context) # 通期/第2四半期予想売上高増減率 xbrl.change_forecast_net_sales = to_f find_value_rv(doc, CHANGE_NET_SALES, context) # 通期/第2四半期予想営業利益増減率 xbrl.change_forecast_operating_income = to_f find_value_rv(doc, CHANGE_OPERATING_INCOME, context) # 通期/第2四半期予想経常利益増減率 xbrl.change_forecast_ordinary_income = to_f find_value_rv(doc, CHANGE_ORDINARY_INCOME, context) # 通期/第2四半期予想純利益増減率 xbrl.change_forecast_net_income = to_f find_value_rv(doc, CHANGE_NET_INCOME, context) xbrl end
find_value_ed(doc, item, context)
click to toggle source
# File lib/litexbrl/tdnet/results_forecast.rb, line 127 def self.find_value_ed(doc, item, context) find_value_tse_t_ed(doc, item, context[:context_duration]) end
find_value_rv(doc, item, context)
click to toggle source
# File lib/litexbrl/tdnet/results_forecast.rb, line 131 def self.find_value_rv(doc, item, context) find_value_tse_t_rv(doc, item, context[:context_duration]) end
find_value_tse_t_rv(doc, item, context)
click to toggle source
修正報告の勘定科目の値を取得します
# File lib/litexbrl/tdnet/results_forecast.rb, line 138 def self.find_value_tse_t_rv(doc, item, context) find_value(doc, item, context) do |item, context| "//xbrli:xbrl/tse-t-rv:#{item}[@contextRef='#{context}']" end end
read_data(doc, season)
click to toggle source
# File lib/litexbrl/tdnet/results_forecast.rb, line 24 def self.read_data(doc, season) xbrl, context = find_base_data(doc, season) find_data(doc, xbrl, context) end