Class: VORuby::VOTable::V1_1::Param
- Inherits:
-
Base
- Object
- XML::Object::Base
- Base
- VORuby::VOTable::V1_1::Param
- Includes:
- Castable
- Defined in:
- lib/voruby/votable/1.1/votable.rb
Overview
A global value associated with (usually) a table.
Constant Summary collapse
- ELEMENT_NAME =
'PARAM'
Instance Attribute Summary
Attributes inherited from XML::Object::Base
Class Method Summary collapse
Instance Method Summary collapse
- #arraysize ⇒ Object
-
#arraysize=(a) ⇒ Object
Set the arraysize (if applicable).
- #datatype ⇒ Object
-
#datatype=(d) ⇒ Object
Set the datatype.
-
#description ⇒ Object
Retrieve the description (Description).
-
#description=(d) ⇒ Object
Set the description (Description).
- #id ⇒ Object
- #id=(i) ⇒ Object
-
#initialize(defn = nil) ⇒ Param
constructor
Create a new parameter.
-
#links ⇒ Object
Retrieve the links.
-
#links=(lnks) ⇒ Object
Set the links.
- #name ⇒ Object
- #name=(n) ⇒ Object
- #precision ⇒ Object
-
#precision=(p) ⇒ Object
Set the precision of the value.
- #ref ⇒ Object
- #ref=(r) ⇒ Object
- #ucd ⇒ Object
-
#ucd=(u) ⇒ Object
Set the unified content descriptor or UCD.
- #unit ⇒ Object
-
#unit=(u) ⇒ Object
Set the unit.
- #utype ⇒ Object
-
#utype=(u) ⇒ Object
Set the utype (i.e. the role of the column in the context of an external data model).
-
#value(cast = false) ⇒ Object
Retrieve the value of the parameter.
-
#value=(v) ⇒ Object
Set the value of the parameter.
-
#values ⇒ Object
Retrieve the values (Values).
-
#values=(v) ⇒ Object
Set the values (Values).
- #width ⇒ Object
-
#width=(w) ⇒ Object
Set the width.
Methods included from Castable
#as_obj, #as_string, #cast, #convert_to_s
Methods inherited from Base
#==, element_name, #get_element, #xpath_for
Methods inherited from XML::Object::Base
#==, element_name, from_file, #to_s
Constructor Details
Class Method Details
.serialization_order ⇒ Object
299 300 301 302 303 304 305 |
# File 'lib/voruby/votable/1.1/votable.rb', line 299 def self.serialization_order [ :description, :values, :links, :id, :unit, :datatype, :arraysize, :precision, :width, :ref, :name, :ucd, :utype, :value ] end |
Instance Method Details
#arraysize ⇒ Object
404 405 406 |
# File 'lib/voruby/votable/1.1/votable.rb', line 404 def arraysize self.node['arraysize'] end |
#arraysize=(a) ⇒ Object
Set the arraysize (if applicable). i.e. *, 8x2
410 411 412 |
# File 'lib/voruby/votable/1.1/votable.rb', line 410 def arraysize=(a) @node['arraysize'] = a.to_s end |
#datatype ⇒ Object
337 338 339 |
# File 'lib/voruby/votable/1.1/votable.rb', line 337 def datatype self.node['datatype'] end |
#datatype=(d) ⇒ Object
Set the datatype. Should be one of: boolean, bit, unsignedByte, short, int, long, char, unicodeChar, float, double, floatComplex, doubleComplex.
344 345 346 |
# File 'lib/voruby/votable/1.1/votable.rb', line 344 def datatype=(d) @node['datatype'] = d.to_s end |
#description ⇒ Object
Retrieve the description (Description).
432 433 434 |
# File 'lib/voruby/votable/1.1/votable.rb', line 432 def description get_element(Description) end |
#description=(d) ⇒ Object
Set the description (Description).
437 438 439 |
# File 'lib/voruby/votable/1.1/votable.rb', line 437 def description=(d) set_element(Description, d) end |
#id ⇒ Object
319 320 321 |
# File 'lib/voruby/votable/1.1/votable.rb', line 319 def id self.node['ID'] end |
#id=(i) ⇒ Object
323 324 325 |
# File 'lib/voruby/votable/1.1/votable.rb', line 323 def id=(i) @node['ID'] = i.to_s end |
#links ⇒ Object
Retrieve the links. Returns a HomogeneousNodeList object.
453 454 455 |
# File 'lib/voruby/votable/1.1/votable.rb', line 453 def links HomogeneousNodeList.new(self.node, xpath_for(Link), Link) end |
#links=(lnks) ⇒ Object
Set the links. Takes an array of Link objects.
459 460 461 |
# File 'lib/voruby/votable/1.1/votable.rb', line 459 def links=(lnks) self.links.replace(lnks) end |
#name ⇒ Object
378 379 380 |
# File 'lib/voruby/votable/1.1/votable.rb', line 378 def name self.node['name'] end |
#name=(n) ⇒ Object
382 383 384 |
# File 'lib/voruby/votable/1.1/votable.rb', line 382 def name=(n) @node['name'] = n.to_s end |
#precision ⇒ Object
348 349 350 |
# File 'lib/voruby/votable/1.1/votable.rb', line 348 def precision self.node['precision'] end |
#precision=(p) ⇒ Object
Set the precision of the value. Should match [EF]?[0-9]*
param.precision = '1'
355 356 357 |
# File 'lib/voruby/votable/1.1/votable.rb', line 355 def precision=(p) @node['precision'] = p.to_s end |
#ref ⇒ Object
370 371 372 |
# File 'lib/voruby/votable/1.1/votable.rb', line 370 def ref self.node['ref'] end |
#ref=(r) ⇒ Object
374 375 376 |
# File 'lib/voruby/votable/1.1/votable.rb', line 374 def ref=(r) @node['ref'] = r.to_s end |
#ucd ⇒ Object
386 387 388 |
# File 'lib/voruby/votable/1.1/votable.rb', line 386 def ucd self.node['ucd'] end |
#ucd=(u) ⇒ Object
Set the unified content descriptor or UCD.
391 392 393 |
# File 'lib/voruby/votable/1.1/votable.rb', line 391 def ucd=(u) @node['ucd'] = u.to_s end |
#unit ⇒ Object
327 328 329 |
# File 'lib/voruby/votable/1.1/votable.rb', line 327 def unit self.node['unit'] end |
#unit=(u) ⇒ Object
Set the unit. Units should be of the form outlined by Vizier.
333 334 335 |
# File 'lib/voruby/votable/1.1/votable.rb', line 333 def unit=(u) @node['unit'] = u.to_s end |
#utype ⇒ Object
395 396 397 |
# File 'lib/voruby/votable/1.1/votable.rb', line 395 def utype self.node['utype'] end |
#utype=(u) ⇒ Object
Set the utype (i.e. the role of the column in the context of an external data model).
400 401 402 |
# File 'lib/voruby/votable/1.1/votable.rb', line 400 def utype=(u) @node['utype'] = u.to_s end |
#value(cast = false) ⇒ Object
Retrieve the value of the parameter. If cast is false (default), the value is returned as a simple string. However, if cast is true, the datatype and arraysize are used to determine a suitable object (or list of objects) to return. See Castable#as_obj for more details.
419 420 421 |
# File 'lib/voruby/votable/1.1/votable.rb', line 419 def value(cast=false) cast ? as_obj(self.value, self.datatype, self.arraysize) : self.node['value'] end |
#value=(v) ⇒ Object
Set the value of the parameter. An attempt is made to convert native ruby types using the datatype and arraysize parameters.
param.value = Complex.new(1.1, 2.2) # etc.
427 428 429 |
# File 'lib/voruby/votable/1.1/votable.rb', line 427 def value=(v) @node['value'] = v.is_a?(String) ? v : as_string(v, self.datatype, self.arraysize) end |
#values ⇒ Object
Retrieve the values (Values).
442 443 444 |
# File 'lib/voruby/votable/1.1/votable.rb', line 442 def values get_element(Values) end |
#values=(v) ⇒ Object
Set the values (Values).
447 448 449 |
# File 'lib/voruby/votable/1.1/votable.rb', line 447 def values=(v) set_element(Values, v) end |
#width ⇒ Object
359 360 361 |
# File 'lib/voruby/votable/1.1/votable.rb', line 359 def width self.node['width'].to_i end |
#width=(w) ⇒ Object
Set the width. Should be an integer.
param.width = 2
366 367 368 |
# File 'lib/voruby/votable/1.1/votable.rb', line 366 def width=(w) @node['width'] = w.to_s end |