Class: Rets::Metadata::Containers::Container
- Inherits:
-
Object
- Object
- Rets::Metadata::Containers::Container
- Defined in:
- lib/rets/metadata/containers.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#fragment ⇒ Object
Returns the value of attribute fragment.
Class Method Summary collapse
Instance Method Summary collapse
- #extract(fragment, attr) ⇒ Object
-
#initialize(fragment) ⇒ Container
constructor
A new instance of Container.
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
#fragment ⇒ Object
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 |