Class: IceGrid::ServerState

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/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.



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

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

Class Method Details

._enumeratorsObject



81
82
83
# File 'lib/IceGrid/Admin.rb', line 81

def ServerState._enumerators
    @@_enumerators
end

.each(&block) ⇒ Object



67
68
69
# File 'lib/IceGrid/Admin.rb', line 67

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

.from_int(val) ⇒ Object



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

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

Instance Method Details

#<=>(other) ⇒ Object



54
55
56
57
# File 'lib/IceGrid/Admin.rb', line 54

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

#hashObject



59
60
61
# File 'lib/IceGrid/Admin.rb', line 59

def hash
    @value.hash
end

#inspectObject



63
64
65
# File 'lib/IceGrid/Admin.rb', line 63

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

#to_iObject



50
51
52
# File 'lib/IceGrid/Admin.rb', line 50

def to_i
    @value
end

#to_sObject



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

def to_s
    @name
end