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.
25 26 27 |
# File 'lib/rets/metadata/containers.rb', line 25 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 21 |
# File 'lib/rets/metadata/containers.rb', line 14 def self.uses(*fields) fields.each do |field| define_method(field) do instance_variable_get("@#{field}") || instance_variable_set("@#{field}", extract(fragment, field.to_s.capitalize)) end end end |
Instance Method Details
#extract(fragment, attr) ⇒ Object
29 30 31 |
# File 'lib/rets/metadata/containers.rb', line 29 def extract(fragment, attr) fragment.attr(attr) end |