class MITS::Document

Constants

DEFAULT_VERSION

Attributes

parser[R]
version[R]

Public Class Methods

new(url, opts = {}) click to toggle source
# 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

Public Instance Methods

companies() { |company| ... } click to toggle source
# 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() { |property| ... } click to toggle source
# 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

Private Instance Methods

company_entity() click to toggle source
# File lib/mits/document.rb, line 33
def company_entity
  Versions.for(:company).select(version)
end
mapper() click to toggle source
# File lib/mits/document.rb, line 41
def mapper
  @mapper ||= Versions.for(:mapper).select(version)
end
physical_property() click to toggle source
# File lib/mits/document.rb, line 37
def physical_property
  parser.within(:PhysicalProperty)
end