Class: Ice::FormatType

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
ruby/Ice/Value.rb

Overview

The marshaling format for class instances.

Constant Summary collapse

CompactFormat =
SlicedFormat =
@@_names =
['CompactFormat', 'SlicedFormat']
@@_values =
[FormatType.new(0), FormatType.new(1)]

Instance Method Summary collapse

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

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

#hashObject



73
74
75
# File 'ruby/Ice/Value.rb', line 73

def hash
    @val.hash
end

#inspectObject



77
78
79
# File 'ruby/Ice/Value.rb', line 77

def inspect
    @@_names[@val] + "(#{@val})"
end

#to_iObject



64
65
66
# File 'ruby/Ice/Value.rb', line 64

def to_i
    @val
end

#to_sObject



60
61
62
# File 'ruby/Ice/Value.rb', line 60

def to_s
    @@_names[@val]
end