Class: IceGrid::ServerState

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
ruby/IceGrid/Admin.rb

Constant Summary collapse

Inactive =
ServerState.new("Inactive", 0)
Activating =
ServerState.new("Activating", 1)
ActivationTimedOut =
ServerState.new("ActivationTimedOut", 2)
Active =
ServerState.new("Active", 3)
Deactivating =
ServerState.new("Deactivating", 4)
Destroying =
ServerState.new("Destroying", 5)
Destroyed =
ServerState.new("Destroyed", 6)
@@_enumerators =
{0=>Inactive, 1=>Activating, 2=>ActivationTimedOut, 3=>Active, 4=>Deactivating, 5=>Destroying, 6=>Destroyed}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ ServerState

Returns a new instance of ServerState.



20
21
22
23
# File 'ruby/IceGrid/Admin.rb', line 20

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

Class Method Details

._enumeratorsObject



60
61
62
# File 'ruby/IceGrid/Admin.rb', line 60

def ServerState._enumerators
    @@_enumerators
end

.each(&block) ⇒ Object



46
47
48
# File 'ruby/IceGrid/Admin.rb', line 46

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

.from_int(val) ⇒ Object



25
26
27
# File 'ruby/IceGrid/Admin.rb', line 25

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

Instance Method Details

#<=>(other) ⇒ Object



37
38
39
40
# File 'ruby/IceGrid/Admin.rb', line 37

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

#hashObject



42
43
44
# File 'ruby/IceGrid/Admin.rb', line 42

def hash
    @value.hash
end

#to_iObject



33
34
35
# File 'ruby/IceGrid/Admin.rb', line 33

def to_i
    @value
end

#to_sObject



29
30
31
# File 'ruby/IceGrid/Admin.rb', line 29

def to_s
    @name
end