Class: Ice::FormatType
Overview
The marshaling format for class instances.
Constant Summary collapse
- CompactFormat =
- SlicedFormat =
- @@_names =
['CompactFormat', 'SlicedFormat']
- @@_values =
[FormatType.new(0), FormatType.new(1)]
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.
50 51 52 53 |
# File 'ruby/Ice/Value.rb', line 50 def initialize(val) fail("invalid value #{val} for FormatType") unless(val >= 0 and val < 2) @val = val end |
Class Method Details
.each(&block) ⇒ Object
81 82 83 |
# File 'ruby/Ice/Value.rb', line 81 def FormatType.each(&block) @@_values.each(&block) end |
.from_int(val) ⇒ Object
55 56 57 58 |
# File 'ruby/Ice/Value.rb', line 55 def FormatType.from_int(val) raise IndexError, "#{val} is out of range 0..1" if(val < 0 || val > 1) @@_values[val] end |
Instance Method Details
#<=>(other) ⇒ Object
68 69 70 71 |
# File 'ruby/Ice/Value.rb', line 68 def <=>(other) other.is_a?(FormatType) or raise ArgumentError, "value must be a FormatType" @val <=> other.to_i end |
#hash ⇒ Object
73 74 75 |
# File 'ruby/Ice/Value.rb', line 73 def hash @val.hash end |
#inspect ⇒ Object
77 78 79 |
# File 'ruby/Ice/Value.rb', line 77 def inspect @@_names[@val] + "(#{@val})" end |
#to_i ⇒ Object
64 65 66 |
# File 'ruby/Ice/Value.rb', line 64 def to_i @val end |
#to_s ⇒ Object
60 61 62 |
# File 'ruby/Ice/Value.rb', line 60 def to_s @@_names[@val] end |