nabaztag_hack_kit 0.1.0.beta2 → 0.1.0.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,26 @@ module NabaztagHackKit
|
|
6
6
|
module Mods
|
7
7
|
module Playground
|
8
8
|
|
9
|
+
module Helpers
|
10
|
+
def commands(commands, command_values)
|
11
|
+
Array(commands).zip(command_values).map do |command, values|
|
12
|
+
[command] + int_array(values.split(","))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def int_array(array)
|
17
|
+
array.map do |entry|
|
18
|
+
if entry.to_i.to_s == entry
|
19
|
+
entry.to_i
|
20
|
+
else
|
21
|
+
entry
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
9
27
|
def self.registered(app)
|
28
|
+
app.helpers Playground::Helpers
|
10
29
|
|
11
30
|
app.get "/" do
|
12
31
|
redirect "/playground"
|
@@ -63,22 +82,6 @@ module NabaztagHackKit
|
|
63
82
|
end
|
64
83
|
end
|
65
84
|
|
66
|
-
private
|
67
|
-
def commands(commands, command_values)
|
68
|
-
Array(commands).zip(command_values).map do |command, values|
|
69
|
-
[command] + int_array(values.split(","))
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def int_array(array)
|
74
|
-
array.map do |entry|
|
75
|
-
if entry.to_i.to_s == entry
|
76
|
-
entry.to_i
|
77
|
-
else
|
78
|
-
entry
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
85
|
end
|
83
86
|
end
|
84
87
|
end
|