Class: Rets::Metadata::Containers::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/rets/metadata/containers.rb

Direct Known Subclasses

RowContainer, SystemContainer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fragment) ⇒ Container

Returns a new instance of Container.



24
25
26
# File 'lib/rets/metadata/containers.rb', line 24

def initialize(fragment)
  self.fragment = fragment
end

Instance Attribute Details

#fragmentObject

Returns the value of attribute fragment.



12
13
14
# File 'lib/rets/metadata/containers.rb', line 12

def fragment
  @fragment
end

Class Method Details

.uses(*fields) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/rets/metadata/containers.rb', line 14

def self.uses(*fields)
  fields.each do |field|
    define_method(field) do
      fields_hash[field] || fields_hash[field] = extract(fragment, field.to_s.capitalize)
    end
  end
end

Instance Method Details

#extract(fragment, attr) ⇒ Object



28
29
30
# File 'lib/rets/metadata/containers.rb', line 28

def extract(fragment, attr)
  fragment.attr(attr)
end