Class: Rets::Metadata::Table

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_fragment, resource) ⇒ Table

Returns a new instance of Table.



23
24
25
26
27
28
29
# File 'lib/rets/metadata/table.rb', line 23

def initialize(table_fragment, resource)
  self.table_fragment = table_fragment
  self.resource = resource
  self.type = table_fragment["DataType"]
  self.name = table_fragment["SystemName"]
  self.long_name = table_fragment["LongName"]
end

Instance Attribute Details

#long_nameObject

Returns the value of attribute long_name.



19
20
21
# File 'lib/rets/metadata/table.rb', line 19

def long_name
  @long_name
end

#nameObject

Returns the value of attribute name.



18
19
20
# File 'lib/rets/metadata/table.rb', line 18

def name
  @name
end

#resourceObject

Returns the value of attribute resource.



21
22
23
# File 'lib/rets/metadata/table.rb', line 21

def resource
  @resource
end

#table_fragmentObject

Returns the value of attribute table_fragment.



20
21
22
# File 'lib/rets/metadata/table.rb', line 20

def table_fragment
  @table_fragment
end

#typeObject

Returns the value of attribute type.



17
18
19
# File 'lib/rets/metadata/table.rb', line 17

def type
  @type
end

Instance Method Details

Print the tree to a file

out

The file to print to. Defaults to $stdout.



34
35
36
37
38
39
40
41
42
43
# File 'lib/rets/metadata/table.rb', line 34

def print_tree(out = $stdout)
  out.puts "    Table: #{name}"
  out.puts "      Resource: #{resource.id}"
  out.puts "      ShortName: #{ table_fragment["ShortName"] }"
  out.puts "      LongName: #{ table_fragment["LongName"] }"
  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



45
46
47
# File 'lib/rets/metadata/table.rb', line 45

def resolve(value)
  value.to_s.strip
end