Class: Edgar::FilingHomepage
- Inherits:
-
Object
- Object
- Edgar::FilingHomepage
- Defined in:
- lib/edgar/filing_homepage.rb
Overview
Parses the SEC filing HTML index page listing document attachments.
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#soup ⇒ Object
readonly
Returns the value of attribute soup.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #datafiles ⇒ Object
- #documents ⇒ Object
- #filers ⇒ Object
-
#initialize(url, soup = nil) ⇒ FilingHomepage
constructor
A new instance of FilingHomepage.
- #period_of_report ⇒ Object
- #primary_documents ⇒ Object
- #primary_html_document ⇒ Object
- #primary_xml_document ⇒ Object
- #to_s ⇒ Object
- #xbrl_document ⇒ Object
Constructor Details
#initialize(url, soup = nil) ⇒ FilingHomepage
Returns a new instance of FilingHomepage.
10 11 12 13 14 |
# File 'lib/edgar/filing_homepage.rb', line 10 def initialize(url, soup = nil) @url = url @soup = soup || fetch_soup @attachments = end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
8 9 10 |
# File 'lib/edgar/filing_homepage.rb', line 8 def @attachments end |
#soup ⇒ Object (readonly)
Returns the value of attribute soup.
8 9 10 |
# File 'lib/edgar/filing_homepage.rb', line 8 def soup @soup end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/edgar/filing_homepage.rb', line 8 def url @url end |
Class Method Details
.empty ⇒ Object
16 17 18 |
# File 'lib/edgar/filing_homepage.rb', line 16 def self.empty new("", Nokogiri::HTML("")) end |
Instance Method Details
#datafiles ⇒ Object
24 25 26 |
# File 'lib/edgar/filing_homepage.rb', line 24 def datafiles @attachments.select(&:xml?) end |
#documents ⇒ Object
20 21 22 |
# File 'lib/edgar/filing_homepage.rb', line 20 def documents @attachments.select { |a| a.html? || a.text? } end |
#filers ⇒ Object
50 51 52 53 54 |
# File 'lib/edgar/filing_homepage.rb', line 50 def filers @soup.css("div.filer, .companyInfo, .mailer").map do |el| { name: el.text.strip } end end |
#period_of_report ⇒ Object
44 45 46 47 48 |
# File 'lib/edgar/filing_homepage.rb', line 44 def period_of_report text = @soup.text match = text.match(/Period of Report\s*:\s*(\S+)/i) match ? match[1] : nil end |
#primary_documents ⇒ Object
28 29 30 |
# File 'lib/edgar/filing_homepage.rb', line 28 def primary_documents @attachments.primary_documents end |
#primary_html_document ⇒ Object
32 33 34 |
# File 'lib/edgar/filing_homepage.rb', line 32 def primary_html_document @attachments.primary_html_document end |
#primary_xml_document ⇒ Object
36 37 38 |
# File 'lib/edgar/filing_homepage.rb', line 36 def primary_xml_document @attachments.primary_xml_document end |
#to_s ⇒ Object
56 57 58 |
# File 'lib/edgar/filing_homepage.rb', line 56 def to_s "#<FilingHomepage #{@url}>" end |
#xbrl_document ⇒ Object
40 41 42 |
# File 'lib/edgar/filing_homepage.rb', line 40 def xbrl_document @attachments.xbrl_document end |