Class: Ice::EndpointSelectionType

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

Constant Summary collapse

Random =
EndpointSelectionType.new("Random", 0)
Ordered =
EndpointSelectionType.new("Ordered", 1)
@@_enumerators =
{0=>Random, 1=>Ordered}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ EndpointSelectionType

Returns a new instance of EndpointSelectionType.



30
31
32
33
# File 'lib/Ice/EndpointTypes.rb', line 30

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

Class Method Details

._enumeratorsObject



69
70
71
# File 'lib/Ice/EndpointTypes.rb', line 69

def EndpointSelectionType._enumerators
    @@_enumerators
end

.each(&block) ⇒ Object



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

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

.from_int(val) ⇒ Object



35
36
37
# File 'lib/Ice/EndpointTypes.rb', line 35

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

Instance Method Details

#<=>(other) ⇒ Object



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

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

#hashObject



52
53
54
# File 'lib/Ice/EndpointTypes.rb', line 52

def hash
    @value.hash
end

#inspectObject



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

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

#to_iObject



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

def to_i
    @value
end

#to_sObject



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

def to_s
    @name
end