google_visualr 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,7 @@ module GoogleVisualr
|
|
22
22
|
# If the column type is 'date' , the value should be a Date object.
|
23
23
|
# If the column type is 'datetime' , the value should be a DateTime or Time object.
|
24
24
|
# If the column type is 'timeofday' , the value should be an array of three or four numbers: [hour, minute, second, optional milliseconds].
|
25
|
+
# Returns an array of strings if given an array
|
25
26
|
# Returns 'null' when value is nil.
|
26
27
|
# Recursive typecasting when value is a hash.
|
27
28
|
def typecast(value)
|
@@ -38,6 +39,8 @@ module GoogleVisualr
|
|
38
39
|
return "new Date(#{value.year}, #{value.month-1}, #{value.day})"
|
39
40
|
when value.nil?
|
40
41
|
return "null"
|
42
|
+
when value.is_a?(Array)
|
43
|
+
return "[" + value.map{|v| typecast(v) }.join(',') + "]"
|
41
44
|
when value.is_a?(Hash)
|
42
45
|
return js_parameters(value)
|
43
46
|
else
|
@@ -74,6 +74,10 @@ describe "GoogleVisualr::ParamsHelper" do
|
|
74
74
|
assert_equal(nil, "null")
|
75
75
|
end
|
76
76
|
|
77
|
+
it "returns array of strings" do
|
78
|
+
assert_equal({:colors => ['a', 'b']}, "{colors: ['a','b']}")
|
79
|
+
end
|
80
|
+
|
77
81
|
it "recursively calls js_parameters" do
|
78
82
|
assert_equal({:a => {:b => {:c => 1}}}, "{a: {b: {c: 1}}}")
|
79
83
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: google_visualr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.0.
|
5
|
+
version: 2.0.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Winston Teo
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-11 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|