Class: VORuby::VOTables::VOTable::Type::PositiveInteger

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

Overview

A class representing a positive integer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(num = nil) ⇒ PositiveInteger

num:

An integer > 0.



292
293
294
295
296
297
298
# File 'lib/voruby/votables/types.rb', line 292

def initialize(num=nil)
if num and num > 0
 @value = num
else
 raise "Positive integer #{num} must be > 0"
end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



288
289
290
# File 'lib/voruby/votables/types.rb', line 288

def value
  @value
end

Instance Method Details

#to_sObject



300
301
302
# File 'lib/voruby/votables/types.rb', line 300

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