Class: VORuby::VOTables::VOTable::Meta::Option
- 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 OPTION element.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value = nil, name = nil, options = []) ⇒ Option
constructor
- value:
-
The value of the optional quantity.
- #to_s ⇒ Object
Constructor Details
#initialize(value = nil, name = nil, options = []) ⇒ Option
- value:
-
The value of the optional quantity.
- name:
-
The name of the option.
- options:
-
A list of suboptions (Type: Meta::Option).
695 696 697 698 699 700 701 702 703 704 705 |
# File 'lib/voruby/votables/meta.rb', line 695 def initialize(value=nil, name=nil, =[]) #raise "Option must have a value" if value == nil @value = value @name = name .each{ |option| Misc::TypeCheck.new(option, Meta::Option).check() } @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
687 688 689 |
# File 'lib/voruby/votables/meta.rb', line 687 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
687 688 689 |
# File 'lib/voruby/votables/meta.rb', line 687 def @options end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
687 688 689 |
# File 'lib/voruby/votables/meta.rb', line 687 def value @value end |
Class Method Details
.from_soap_obj(moptions) ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/voruby/votables/transforms.rb', line 296 def self.from_soap_obj() = [] .each do |moption| .push(Option.new( VOTable::_find_attr_value(mvalues.__xmlattr, 'value'), VOTable::_find_attr_value(mvalues.__xmlattr, 'name'), (moption.respond_to?(:oPTION))? Option.from_soap_obj(moption.oPTION): [] )) end end |
.from_xml(node) ⇒ Object
289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/voruby/votables/rexml_parser.rb', line 289 def self.from_xml(node) value = node.attributes['value'] if node.attributes['value'] name = node.attributes['name'] if node.attributes['name'] = [] node.elements.each('OPTION'){ |optNode| .push(Meta::Option.from_xml(optNode)) } return self.new(value, name, ) end |
Instance Method Details
#to_s ⇒ Object
707 708 709 710 711 712 |
# File 'lib/voruby/votables/meta.rb', line 707 def to_s = @options.collect{|x| x.to_s}.join('|') "{value=#{@value};name=#{@name};" + "options=#{}}" end |