Class: VORuby::VOTables::VOTable::Type::ArrayDef

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

Overview

A class representing a definition of an array size.

Constant Summary collapse

@@pattern =
'^([0-9]+x)*[0-9]*[*]?(s\W)?$'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(txt = nil) ⇒ ArrayDef

txt:

The text of the array size definition. The allowed pattern is:

^([0-9]+x)*[0-9]*[*]?(s\W)?$

i.e. *, 64x64x10*, etc.



79
80
81
82
83
84
85
# File 'lib/voruby/votables/types.rb', line 79

def initialize(txt=nil)
if txt and txt.match(@@pattern)
 @value = txt
else
 raise "Array definition '#{txt}' does not match #{@@pattern}"
end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



72
73
74
# File 'lib/voruby/votables/types.rb', line 72

def value
  @value
end

Instance Method Details

#to_sObject



87
88
89
# File 'lib/voruby/votables/types.rb', line 87

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