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_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_nameObject (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

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/rets/metadata/table.rb', line 4

def name
  @name
end

#resource_idObject (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_fragmentObject (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 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