Class: Rets::Metadata::Table
- Inherits:
-
Object
- Object
- Rets::Metadata::Table
- Defined in:
- lib/rets/metadata/table.rb
Instance Attribute Summary collapse
-
#long_name ⇒ Object
readonly
Returns the value of attribute long_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#resource_id ⇒ Object
readonly
Returns the value of attribute resource_id.
-
#table_fragment ⇒ Object
readonly
Returns the value of attribute table_fragment.
Instance Method Summary collapse
-
#initialize(table_fragment, resource_id) ⇒ Table
constructor
A new instance of Table.
-
#print_tree(out = $stdout) ⇒ Object
Print the tree to a file.
- #resolve(value) ⇒ Object
Constructor Details
#initialize(table_fragment, resource_id) ⇒ Table
Returns a new instance of Table.
6 7 8 9 10 11 12 |
# File 'lib/rets/metadata/table.rb', line 6 def initialize(table_fragment, resource_id) @table_fragment = table_fragment @resource_id = resource_id @name = table_fragment["SystemName"] @long_name = table_fragment["LongName"] end |
Instance Attribute Details
#long_name ⇒ Object (readonly)
Returns the value of attribute long_name.
4 5 6 |
# File 'lib/rets/metadata/table.rb', line 4 def long_name @long_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/rets/metadata/table.rb', line 4 def name @name end |
#resource_id ⇒ Object (readonly)
Returns the value of attribute resource_id.
4 5 6 |
# File 'lib/rets/metadata/table.rb', line 4 def resource_id @resource_id end |
#table_fragment ⇒ Object (readonly)
Returns the value of attribute table_fragment.
4 5 6 |
# File 'lib/rets/metadata/table.rb', line 4 def table_fragment @table_fragment end |
Instance Method Details
#print_tree(out = $stdout) ⇒ Object
Print the tree to a file
- out
-
The file to print to. Defaults to $stdout.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rets/metadata/table.rb', line 17 def print_tree(out = $stdout) out.puts "### Table: #{name}" out.puts " Resource: #{resource_id}" out.puts " ShortName: #{ table_fragment["ShortName"] }" out.puts " LongName: #{ long_name }" out.puts " StandardName: #{ table_fragment["StandardName"] }" out.puts " Units: #{ table_fragment["Units"] }" out.puts " Searchable: #{ table_fragment["Searchable"] }" out.puts " Required: #{table_fragment['Required']}" end |
#resolve(value) ⇒ Object
28 29 30 |
# File 'lib/rets/metadata/table.rb', line 28 def resolve(value) value.to_s.strip end |