Class: ILORb::RIBCL::Command
- Inherits:
-
Object
- Object
- ILORb::RIBCL::Command
- Defined in:
- lib/ilorb/ribcl.rb
Overview
Implements ILO API commands with their parameters
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, context, mode) ⇒ Command
constructor
A new instance of Command.
- #map_elements ⇒ Object
- #supported? ⇒ Boolean
Constructor Details
#initialize(name, context, mode) ⇒ Command
Returns a new instance of Command.
63 64 65 66 67 68 69 |
# File 'lib/ilorb/ribcl.rb', line 63 def initialize(name, context, mode) @name, @context, @mode = name.to_sym, context, mode @attributes = [] @elements = {} @text = nil @supported = true end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
61 62 63 |
# File 'lib/ilorb/ribcl.rb', line 61 def context @context end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
61 62 63 |
# File 'lib/ilorb/ribcl.rb', line 61 def mode @mode end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
61 62 63 |
# File 'lib/ilorb/ribcl.rb', line 61 def name @name end |
Instance Method Details
#map_elements ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/ilorb/ribcl.rb', line 81 def map_elements map = {} @elements.each do |name, type| if type == :value map.store(name, [name, type]) elsif type.is_a?(Array) type.each do |elt| map.store("#{name}_#{elt}".to_sym, [name, elt]) end else map.store("#{name}_#{type}".to_sym, [name, type]) end end map end |
#supported? ⇒ Boolean
77 78 79 |
# File 'lib/ilorb/ribcl.rb', line 77 def supported? @supported end |