Class: VORuby::VOTables::VOTable::Type::NonNegativeInteger

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

Overview

A class representing 0 or a positive integer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(num = nil) ⇒ NonNegativeInteger

num:

An integer >= 0.



311
312
313
314
315
316
317
# File 'lib/voruby/votables/types.rb', line 311

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



307
308
309
# File 'lib/voruby/votables/types.rb', line 307

def value
  @value
end

Instance Method Details

#to_sObject



319
320
321
# File 'lib/voruby/votables/types.rb', line 319

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