Class: MITS::Document
- Inherits:
-
Object
- Object
- MITS::Document
- Defined in:
- lib/mits/document.rb
Constant Summary collapse
- DEFAULT_VERSION =
'4.1'
Instance Attribute Summary collapse
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #companies ⇒ Object
-
#initialize(url, opts = {}) ⇒ Document
constructor
A new instance of Document.
- #properties ⇒ Object
Constructor Details
#initialize(url, opts = {}) ⇒ Document
Returns a new instance of Document.
7 8 9 10 11 12 13 |
# File 'lib/mits/document.rb', line 7 def initialize(url, opts = {}) @version = (opts[:version] || DEFAULT_VERSION).to_s @parser = ::Saxerator.parser(open(url)) do |c| c.put_attributes_in_hash! c.symbolize_keys! end end |
Instance Attribute Details
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
3 4 5 |
# File 'lib/mits/document.rb', line 3 def parser @parser end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/mits/document.rb', line 3 def version @version end |
Instance Method Details
#companies ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/mits/document.rb', line 23 def companies return enum_for(:companies) unless block_given? physical_property.within(:Management).within(:PropertyContacts).each do |tag| yield mapper.company(tag, company_entity) end end |
#properties ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/mits/document.rb', line 15 def properties return enum_for(:properties) unless block_given? physical_property.for_tag(:Property).each do |tag| yield mapper.property(tag) end end |