Class: VORuby::VOTables::VOTable::Type::DataType
- 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
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(txt = nil) ⇒ DataType
constructor
- txt:
-
The datatype.
- #to_s ⇒ Object
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
#value ⇒ Object (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_s ⇒ Object
133 134 135 |
# File 'lib/voruby/votables/types.rb', line 133 def to_s "{#{@value}}" end |