Class: VORuby::VOTables::VOTable::Type::PrecisionType
- Defined in:
- lib/voruby/votables/types.rb
Overview
A class representing a precision type.
Constant Summary collapse
- @@pattern =
'^[EF]?[1-9][0-9]*$'
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(txt = nil) ⇒ PrecisionType
constructor
- txt:
-
The precision type.
- #to_s ⇒ Object
Constructor Details
#initialize(txt = nil) ⇒ PrecisionType
- txt:
-
The precision type. The allowed pattern is:
^[EF]?[1-9][0-9]*$
i.e. F3, 5 etc.
147 148 149 150 151 152 153 |
# File 'lib/voruby/votables/types.rb', line 147 def initialize(txt=nil) if txt and txt.match(@@pattern) @value = txt else raise "Precision type '#{txt}' does not match #{@@pattern}" end end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
140 141 142 |
# File 'lib/voruby/votables/types.rb', line 140 def value @value end |
Instance Method Details
#to_s ⇒ Object
155 156 157 |
# File 'lib/voruby/votables/types.rb', line 155 def to_s "{#{@value}}" end |