Class: VORuby::VOTables::VOTable::Type::PrecisionType

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#valueObject (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_sObject



155
156
157
# File 'lib/voruby/votables/types.rb', line 155

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