Class: VORuby::VOTables::VOTable::Meta::Values
- 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 VALUES element.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
-
#null ⇒ Object
readonly
Returns the value of attribute null.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(min = nil, max = nil, options = [], id = nil, type = Type::ValuesType.new('legal'), null = nil, ref = nil) ⇒ Values
constructor
- min:
-
The minimum value of the described quantity (Type: Meta::Min).
- #to_s ⇒ Object
Constructor Details
#initialize(min = nil, max = nil, options = [], id = nil, type = Type::ValuesType.new('legal'), null = nil, ref = nil) ⇒ Values
- min:
-
The minimum value of the described quantity (Type: Meta::Min).
- max:
-
The maximum value of the described quantity (Type: Meta::Max).
- options:
-
A list of options (keywords) associated with the value (Type: Meta::Option).
- id:
-
An ID to assign to the value.
- Type:
-
The Type of the value (Type: Type::ValuesType).
- null:
-
The value used to define non-existent data.
- ref:
-
A reference to an already extant domain definition.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/voruby/votables/meta.rb', line 155 def initialize(min=nil, max=nil, =[], id=nil, type=Type::ValuesType.new('legal'), null=nil, ref=nil) Misc::TypeCheck.new(min, Meta::Min).check() @min = min raise Misc::TypeException.new(max, Meta::Max) if max and !max.is_a?(Max) Misc::TypeCheck.new(max, Meta::Max).check() .each{ |option| Misc::TypeCheck.new(option, Meta::Option).check() } @options = @id = id Misc::TypeCheck.new(Type, Type::ValuesType).check() @type = type @null = null @ref = ref end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
139 140 141 |
# File 'lib/voruby/votables/meta.rb', line 139 def id @id end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
139 140 141 |
# File 'lib/voruby/votables/meta.rb', line 139 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
139 140 141 |
# File 'lib/voruby/votables/meta.rb', line 139 def min @min end |
#null ⇒ Object (readonly)
Returns the value of attribute null.
139 140 141 |
# File 'lib/voruby/votables/meta.rb', line 139 def null @null end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
139 140 141 |
# File 'lib/voruby/votables/meta.rb', line 139 def @options end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
139 140 141 |
# File 'lib/voruby/votables/meta.rb', line 139 def ref @ref end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
139 140 141 |
# File 'lib/voruby/votables/meta.rb', line 139 def type @type end |
Class Method Details
.from_soap_obj(mvalues) ⇒ Object
280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/voruby/votables/transforms.rb', line 280 def self.from_soap_obj(mvalues) type_txt = VOTable::_find_attr_value(mvalues.__xmlattr, 'type') || 'legal' Values.new( (mvalues.respond_to?(:mIN))? Min.from_soap_obj(mvalues.mIN): nil, (mvalues.respond_to?(:mAX))? Max.from_soap_obj(mvalues.mAX): nil, (mvalues.respond_to?(:oPTIONS))? Option.from_soap_obj(mvalues.oPTIONS): [], VOTable::_find_attr_value(mvalues.__xmlattr, 'ID'), (type_txt == nil)? nil: Type::ValuesType.new(type_txt), VOTable::_find_attr_value(mvalues.__xmlattr, 'null'), VOTable::_find_attr_value(mvalues.__xmlattr, 'ref') ) end |
.from_xml(node) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/voruby/votables/rexml_parser.rb', line 58 def self.from_xml(node) # Attributes id = node.attributes['ID'] if node.attributes['ID'] type = Type::ValuesType.new(node.attributes['type']) if node.attributes['type'] null = node.attributes['null'] if node.attributes['null'] ref = node.attributes['ref'] if node.attributes['ref'] # Elements min = Meta::Min.from_xml(node.elements.to_a('MIN').first) if node.elements['MIN'] max = Meta::Max.from_xml(node.elements.to_a('MAX').first) if node.elements['MAX'] = [] node.elements.each('OPTION'){ |optNode| .push(Meta::Option.from_xml(optNode)) } return self.new(min, max, , id, type, null, ref) end |
Instance Method Details
#to_s ⇒ Object
178 179 180 181 182 183 184 |
# File 'lib/voruby/votables/meta.rb', line 178 def to_s = @options.collect{|x| x.to_s}.join('|') "{min=#{@min};max=#{@max};" + "options=#{};" + "id=#{@id};type=#{@type};null=#{@null};ref=#{@ref}}" end |