Class: ILORb::RIBCL::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/ilorb/ribcl.rb

Overview

Implements ILO API commands with their parameters

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contextObject (readonly)

Returns the value of attribute context.



61
62
63
# File 'lib/ilorb/ribcl.rb', line 61

def context
  @context
end

#modeObject (readonly)

Returns the value of attribute mode.



61
62
63
# File 'lib/ilorb/ribcl.rb', line 61

def mode
  @mode
end

#nameObject (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_elementsObject



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

Returns:

  • (Boolean)


77
78
79
# File 'lib/ilorb/ribcl.rb', line 77

def supported?
  @supported
end