Class: Gaptool::SetCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/gaptool_client/commands.rb

Instance Method Summary collapse

Instance Method Details

#convert_bool(v) ⇒ Object



222
223
224
225
226
227
228
229
230
231
# File 'lib/gaptool_client/commands.rb', line 222

def convert_bool(v)
  case v.downcase
  when 'true'
    true
  when 'false'
    false
  else
    v
  end
end

#executeObject



233
234
235
236
237
238
239
# File 'lib/gaptool_client/commands.rb', line 233

def execute
  if parameter_list.length != value_list.length
    puts Rainbow('parameter and value length mismatch').red
  end
  params = Hash[parameter_list.each_with_index.map { |p, i| [p, convert_bool(value_list[i])] }]
  Gaptool::Helpers.info([Gaptool::API.client.setparameters(instance, params)], parseable?, grepable?)
end