Class: Ice::OperationMode

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

Constant Summary collapse

Normal =
OperationMode.new("Normal", 0)
Nonmutating =
OperationMode.new("Nonmutating", 1)
Idempotent =
OperationMode.new("Idempotent", 2)
@@_enumerators =
{0=>Normal, 1=>Nonmutating, 2=>Idempotent}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ OperationMode

Returns a new instance of OperationMode.



38
39
40
41
# File 'lib/Ice/Current.rb', line 38

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

Class Method Details

._enumeratorsObject



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

def OperationMode._enumerators
    @@_enumerators
end

.each(&block) ⇒ Object



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

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

.from_int(val) ⇒ Object



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

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

Instance Method Details

#<=>(other) ⇒ Object



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

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

#hashObject



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

def hash
    @value.hash
end

#inspectObject



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

def inspect
    @name + "(#{@value})"
end

#to_iObject



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

def to_i
    @value
end

#to_sObject



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

def to_s
    @name
end