Class: Edgar::Attachments
- Inherits:
-
Object
- Object
- Edgar::Attachments
- Includes:
- Enumerable
- Defined in:
- lib/edgar/attachments.rb
Overview
Enumerable collection of Attachment objects for a filing.
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #datafiles ⇒ Object
- #documents ⇒ Object
- #each(&block) ⇒ Object
- #exhibits ⇒ Object
-
#initialize(attachments = []) ⇒ Attachments
constructor
A new instance of Attachments.
- #length ⇒ Object
- #primary_documents ⇒ Object
- #primary_html_document ⇒ Object
- #primary_xml_document ⇒ Object
- #reports ⇒ Object
- #statements ⇒ Object
- #to_s ⇒ Object
- #xbrl_document ⇒ Object
Constructor Details
#initialize(attachments = []) ⇒ Attachments
Returns a new instance of Attachments.
10 11 12 |
# File 'lib/edgar/attachments.rb', line 10 def initialize( = []) @attachments = end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
8 9 10 |
# File 'lib/edgar/attachments.rb', line 8 def @attachments end |
Instance Method Details
#[](index) ⇒ Object
18 19 20 |
# File 'lib/edgar/attachments.rb', line 18 def [](index) @attachments[index] end |
#datafiles ⇒ Object
63 64 65 |
# File 'lib/edgar/attachments.rb', line 63 def datafiles select(&:xml?) end |
#documents ⇒ Object
67 68 69 |
# File 'lib/edgar/attachments.rb', line 67 def documents select { |a| a.html? || a.text? } end |
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/edgar/attachments.rb', line 14 def each(&block) @attachments.each(&block) end |
#exhibits ⇒ Object
26 27 28 |
# File 'lib/edgar/attachments.rb', line 26 def exhibits select { |a| a.purpose&.downcase&.include?("exhibit") } end |
#length ⇒ Object
22 23 24 |
# File 'lib/edgar/attachments.rb', line 22 def length @attachments.length end |
#primary_documents ⇒ Object
38 39 40 41 |
# File 'lib/edgar/attachments.rb', line 38 def primary_documents sorted = sort_by(&:sequence_number) sorted.select { |a| a.sequence_number == sorted.first&.sequence_number } end |
#primary_html_document ⇒ Object
43 44 45 46 |
# File 'lib/edgar/attachments.rb', line 43 def primary_html_document sorted = sort_by(&:sequence_number) sorted.find(&:html?) end |
#primary_xml_document ⇒ Object
48 49 50 |
# File 'lib/edgar/attachments.rb', line 48 def primary_xml_document find(&:xml?) end |
#reports ⇒ Object
30 31 32 |
# File 'lib/edgar/attachments.rb', line 30 def reports select { |a| a.purpose&.downcase&.include?("report") } end |
#statements ⇒ Object
34 35 36 |
# File 'lib/edgar/attachments.rb', line 34 def statements select { |a| a.purpose&.downcase&.include?("statement") } end |
#to_s ⇒ Object
71 72 73 |
# File 'lib/edgar/attachments.rb', line 71 def to_s "#<Attachments count=#{@attachments.length}>" end |
#xbrl_document ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/edgar/attachments.rb', line 52 def xbrl_document # Standard XBRL instance (EX-101.INS) or iXBRL-tagged document found = find { |a| a.document_type == "EX-101.INS" || a.ixbrl } return found if found # Fallback: look for _htm.xml extracted XBRL instance (common in modern # iXBRL filings where the instance is embedded in the HTML and an XML # copy is provided as a datafile) find { |a| a.document&.end_with?("_htm.xml") } end |