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.



51
52
53
54
# File 'ruby/Ice/Value.rb', line 51

def initialize(val)
    fail("invalid value #{val} for FormatType") unless(val >= 0 and val < 2)
    @val = val
end

Instance Method Details

#<=>(other) ⇒ Object



69
70
71
# File 'ruby/Ice/Value.rb', line 69

def <=>(other)
    @val <=> other.to_i if other.is_a?(FormatType)
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



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

def to_i
    @val
end

#to_sObject



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

def to_s
    @@_names[@val]
end