Class: VORuby::VOTables::VOTable::Meta::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/votables/meta.rb,
lib/voruby/votables/transforms.rb,
lib/voruby/votables/rexml_parser.rb,
lib/voruby/votables/libxml_parser.rb

Overview

A class representing the standard VOTable INFO element.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, value = nil, id = nil, text = nil) ⇒ Info

name:

The name of the name/value pair.

value:

The value of the name/value pair.

id:

The unique identifier of the name/value pair.



491
492
493
494
495
496
497
498
499
# File 'lib/voruby/votables/meta.rb', line 491

def initialize(name=nil, value=nil, id=nil, text=nil)
# raise "Info must define a name" if name == nil
#	raise "Info must define a value" if value == nil
	
@name = name
 @value = value
@id = id
@text = text
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



483
484
485
# File 'lib/voruby/votables/meta.rb', line 483

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



483
484
485
# File 'lib/voruby/votables/meta.rb', line 483

def name
  @name
end

#textObject (readonly)

Returns the value of attribute text.



483
484
485
# File 'lib/voruby/votables/meta.rb', line 483

def text
  @text
end

#valueObject (readonly)

Returns the value of attribute value.



483
484
485
# File 'lib/voruby/votables/meta.rb', line 483

def value
  @value
end

Class Method Details

.from_soap_obj(minfo) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/voruby/votables/transforms.rb', line 93

def self.from_soap_obj(minfo)
  info = []
  info.push(Info.new(
    VOTable::_find_attr_value(minfo.__xmlattr, 'name'),
    VOTable::_find_attr_value(minfo.__xmlattr, 'value'),
    VOTable::_find_attr_value(minfo.__xmlattr, 'ID'),
    minfo.__xmlele # text
  ))
        
  info
end

.from_xml(node) ⇒ Object



190
191
192
193
194
195
196
197
# File 'lib/voruby/votables/rexml_parser.rb', line 190

def self.from_xml(node)
  id = node.attributes['ID']
  name = node.attributes['name']
  value = node.attributes['value']
  text = node.text
      
  return self.new(name, value, id, text)
end

Instance Method Details

#to_sObject



501
502
503
# File 'lib/voruby/votables/meta.rb', line 501

def to_s
"{name=#{@name};value=#{@value};id=#{@id};text=#{@text}}"
end