Class: Edgar::XBRL::InlineXBRL
- Inherits:
-
XBRL
- Object
- XBRL
- Edgar::XBRL::InlineXBRL
show all
- Defined in:
- lib/edgar/xbrl/xbrl.rb
Overview
Parses Inline XBRL (iXBRL) HTML documents with embedded financial facts.
Instance Attribute Summary
Attributes inherited from XBRL
#raw
Instance Method Summary
collapse
Methods inherited from XBRL
#initialize, #to_s, #units
Instance Method Details
#context_refs ⇒ Object
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/edgar/xbrl/xbrl.rb', line 112
def context_refs
@doc.css("context").map do |ctx|
{
id: ctx["id"],
start_date: ctx.at_css("startDate")&.text&.strip,
end_date: ctx.at_css("endDate")&.text&.strip,
instant: ctx.at_css("instant")&.text&.strip
}
end
end
|
#facts ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/edgar/xbrl/xbrl.rb', line 95
def facts
inline_elements = @doc.css("[name]").select do |el|
el["name"].to_s.include?(":") && el["contextref"]
end
inline_elements.map do |el|
{
name: el["name"],
value: el.text.strip,
context_ref: el["contextref"],
unit_ref: el["unitref"],
decimals: el["decimals"],
format: el["format"],
scale: el["scale"]
}
end
end
|
#financial_concepts ⇒ Object
123
124
125
|
# File 'lib/edgar/xbrl/xbrl.rb', line 123
def financial_concepts
facts.select { |f| f[:name]&.include?("us-gaap") || f[:name]&.include?("dei") }
end
|