Module: NabaztagHackKit::Mods::Playground::Helpers

Defined in:
lib/nabaztag_hack_kit/mods/playground.rb

Instance Method Summary collapse

Instance Method Details

#commands(commands, command_values) ⇒ Object



11
12
13
14
15
# File 'lib/nabaztag_hack_kit/mods/playground.rb', line 11

def commands(commands, command_values)
  Array(commands).zip(command_values).map do |command, values|
    [command] + int_array(values.split(','))
  end
end

#int_array(array) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/nabaztag_hack_kit/mods/playground.rb', line 17

def int_array(array)
  array.map do |entry|
    if entry.to_i.to_s == entry
      entry.to_i
    else
      entry
    end
  end
end