Class: CloudRailSi::ServiceCode::GetKeyValueArrays

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudrail_si/servicecode/commands/object/GetKeyValueArrays.rb

Instance Method Summary collapse

Instance Method Details

#execute(environment, parameters) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cloudrail_si/servicecode/commands/object/GetKeyValueArrays.rb', line 10

def execute(environment, parameters)
    Helper.assert(parameters.length === 3 &&
                  Helper.is_var_address(parameters[0]) &&
                  Helper.is_var_address(parameters[1]) &&
                  Helper.is_var_address(parameters[2]))
    result_keys_var = parameters[0]
    result_values_var = parameters[1]
    container = Helper.resolve(environment, parameters[2])
    keys = container.keys
    values = []
    (0..keys.length - 1).each do |i|
        key = keys[i]
        values.push(container[key])
    end
    environment.set_variable(result_keys_var, keys)
    environment.set_variable(result_values_var, values)
end

#get_identifierObject



6
7
8
# File 'lib/cloudrail_si/servicecode/commands/object/GetKeyValueArrays.rb', line 6

def get_identifier
    'object.getKeyValueArrays'
end