Class: VORuby::VOTables::VOTable::Type::NonNegativeInteger
- Defined in:
- lib/voruby/votables/types.rb
Overview
A class representing 0 or a positive integer.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(num = nil) ⇒ NonNegativeInteger
constructor
- num:
-
An integer >= 0.
- #to_s ⇒ Object
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
#value ⇒ Object (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_s ⇒ Object
319 320 321 |
# File 'lib/voruby/votables/types.rb', line 319 def to_s "{#{@value.to_s}}" end |