Class: IRXML::Edgar::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/irxml/edgar.rb

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Document

Returns a new instance of Document.



25
26
27
# File 'lib/irxml/edgar.rb', line 25

def initialize(node)
  set_values(node)
end

Instance Method Details

#attributesObject



29
30
31
# File 'lib/irxml/edgar.rb', line 29

def attributes
  @attributes ||= {}
end

#filing_urlObject



33
34
35
# File 'lib/irxml/edgar.rb', line 33

def filing_url
  "http://investor.shareholder.com/#{IRXML.company_id.downcase}/secfiling.cfm?filingID=#{attributes['fid']}"
end

#set_values(node) ⇒ Object



37
38
39
40
41
42
# File 'lib/irxml/edgar.rb', line 37

def set_values(node)
  node.children.each do |tag|
    attributes[tag.name.downcase] = tag.content
    self.class.class_eval { define_method(tag.name.downcase) { attributes[tag.name.downcase] } }
  end
end