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