Class: Ice::ToStringMode

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/Ice/Communicator.rb

Constant Summary collapse

Unicode =
ToStringMode.new("Unicode", 0)
ASCII =
ToStringMode.new("ASCII", 1)
Compat =
ToStringMode.new("Compat", 2)
@@_enumerators =
{0=>Unicode, 1=>ASCII, 2=>Compat}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ ToStringMode

Returns a new instance of ToStringMode.



42
43
44
45
# File 'lib/Ice/Communicator.rb', line 42

def initialize(name, value)
    @name = name
    @value = value
end

Class Method Details

._enumeratorsObject



78
79
80
# File 'lib/Ice/Communicator.rb', line 78

def ToStringMode._enumerators
    @@_enumerators
end

.each(&block) ⇒ Object



68
69
70
# File 'lib/Ice/Communicator.rb', line 68

def ToStringMode.each(&block)
    @@_enumerators.each_value(&block)
end

.from_int(val) ⇒ Object



47
48
49
# File 'lib/Ice/Communicator.rb', line 47

def ToStringMode.from_int(val)
    @@_enumerators[val]
end

Instance Method Details

#<=>(other) ⇒ Object



59
60
61
62
# File 'lib/Ice/Communicator.rb', line 59

def <=>(other)
    other.is_a?(ToStringMode) or raise ArgumentError, "value must be a ToStringMode"
    @value <=> other.to_i
end

#hashObject



64
65
66
# File 'lib/Ice/Communicator.rb', line 64

def hash
    @value.hash
end

#to_iObject



55
56
57
# File 'lib/Ice/Communicator.rb', line 55

def to_i
    @value
end

#to_sObject



51
52
53
# File 'lib/Ice/Communicator.rb', line 51

def to_s
    @name
end