Class: Ice::FormatType
Constant Summary collapse
- DefaultFormat =
- CompactFormat =
- SlicedFormat =
- @@_names =
['DefaultFormat', 'CompactFormat', 'SlicedFormat']
- @@_values =
[FormatType.new(0), FormatType.new(1), FormatType.new(2)]
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(val) ⇒ FormatType
constructor
A new instance of FormatType.
- #inspect ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(val) ⇒ FormatType
Returns a new instance of FormatType.
195 196 197 198 |
# File 'lib/Ice.rb', line 195 def initialize(val) fail("invalid value #{val} for FormatType") unless(val >= 0 and val < 3) @val = val end |
Class Method Details
.each(&block) ⇒ Object
226 227 228 |
# File 'lib/Ice.rb', line 226 def FormatType.each(&block) @@_values.each(&block) end |
.from_int(val) ⇒ Object
200 201 202 203 |
# File 'lib/Ice.rb', line 200 def FormatType.from_int(val) raise IndexError, "#{val} is out of range 0..2" if(val < 0 || val > 2) @@_values[val] end |
Instance Method Details
#<=>(other) ⇒ Object
213 214 215 216 |
# File 'lib/Ice.rb', line 213 def <=>(other) other.is_a?(FormatType) or raise ArgumentError, "value must be a FormatType" @val <=> other.to_i end |
#hash ⇒ Object
218 219 220 |
# File 'lib/Ice.rb', line 218 def hash @val.hash end |
#inspect ⇒ Object
222 223 224 |
# File 'lib/Ice.rb', line 222 def inspect @@_names[@val] + "(#{@val})" end |
#to_i ⇒ Object
209 210 211 |
# File 'lib/Ice.rb', line 209 def to_i @val end |
#to_s ⇒ Object
205 206 207 |
# File 'lib/Ice.rb', line 205 def to_s @@_names[@val] end |