Class: VORuby::VOTables::VOTable::Type::DataType

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/votables/types.rb

Overview

A class representing a datatype.

Constant Summary collapse

@@types =
['boolean', 'bit', 'unsignedByte', 'short', 'int',
'long', 'char', 'unicodeChar', 'float', 'double',
'floatComplex', 'doubleComplex']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(txt = nil) ⇒ DataType

txt:

The datatype. Choices: boolean, bit, unsignedByte, short, int long, char, unicodeChar, float, double, floatComplex, doubleComplex.



124
125
126
127
128
129
130
131
# File 'lib/voruby/votables/types.rb', line 124

def initialize(txt=nil)
if txt and @@types.include?(txt)
  @value = txt
else
 raise "Data type '#{txt}' is not valid.  Use one of: " +
	  @@types.join(', ')
end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



116
117
118
# File 'lib/voruby/votables/types.rb', line 116

def value
  @value
end

Instance Method Details

#to_sObject



133
134
135
# File 'lib/voruby/votables/types.rb', line 133

def to_s
"{#{@value}}"
end