Class: VmInfo::State
- Inherits:
-
Object
- Object
- VmInfo::State
- Defined in:
- lib/archipel/api/vm/vm_info.rb
Constant Summary collapse
- STARTED =
new 1, 'started'
- STOPPED =
new 5, 'stopped'
- @@index =
{}
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value, name) ⇒ State
constructor
A new instance of State.
- #method_missing(method, *args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value, name) ⇒ State
Returns a new instance of State.
10 11 12 13 |
# File 'lib/archipel/api/vm/vm_info.rb', line 10 def initialize value, name @value, @name = value, name @@index[value] = self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/archipel/api/vm/vm_info.rb', line 22 def method_missing method, *args if method[-1] == '?' method[0..-2] == name else super end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/archipel/api/vm/vm_info.rb', line 7 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/archipel/api/vm/vm_info.rb', line 7 def value @value end |
Class Method Details
.from_int(value) ⇒ Object
34 35 36 |
# File 'lib/archipel/api/vm/vm_info.rb', line 34 def self.from_int value @@index[value] end |
Instance Method Details
#to_s ⇒ Object
30 31 32 |
# File 'lib/archipel/api/vm/vm_info.rb', line 30 def to_s "VM state: #{name} (#{value})" end |