rgviz-rails 0.58 → 0.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -368,7 +368,7 @@ module Rgviz
368
368
  self
369
369
  end
370
370
  def value.encode_json(*)
371
- "new Date(#{strftime('%Y, %d, %m')})"
371
+ "new Date(#{strftime('%Y,%d,%m')})"
372
372
  end
373
373
  value
374
374
  when :datetime
@@ -377,7 +377,7 @@ module Rgviz
377
377
  self
378
378
  end
379
379
  def value.encode_json(*)
380
- "new Date(#{strftime('%Y, %d, %m, %H, %M, %S')})"
380
+ "new Date(#{strftime('%Y,%d,%m,%H,%M,%S')})"
381
381
  end
382
382
  value
383
383
  when :timeofday
@@ -386,7 +386,7 @@ module Rgviz
386
386
  self
387
387
  end
388
388
  def value.encode_json(*)
389
- "new Date(#{strftime('0, 0, 0, %H, %M, %S')})"
389
+ "new Date(#{strftime('0,0,0,%H,%M,%S')})"
390
390
  end
391
391
  value
392
392
  else
@@ -83,7 +83,7 @@ module Rgviz
83
83
  raise "Must specify a :kind" unless kind
84
84
  raise "Must specify a :url" unless url
85
85
 
86
- custom_executor = (url.is_a?(Class) and url < ActiveRecord::Base) || url.respond_to?(:execute) || url.is_a?(Rgviz::Table)
86
+ custom_executor = (url.is_a?(Class) and url < ActiveRecord::Base) || url.respond_to?(:execute) || url.is_a?(Rgviz::Table) || url.is_a?(Array)
87
87
  url = url_for url unless custom_executor
88
88
 
89
89
  # Parse the query
@@ -189,18 +189,22 @@ module Rgviz
189
189
  end
190
190
 
191
191
  if custom_executor
192
- executor_options = {}
193
- executor_options[:conditions] = conditions if conditions
194
- executor_options[:extensions] = extensions if extensions
195
-
196
- table = if url.is_a?(Class) and url < ActiveRecord::Base
197
- Rgviz::Executor.new(url).execute(query, executor_options)
198
- elsif url.respond_to?(:execute)
199
- url.execute(query, executor_options)
200
- else
201
- url
202
- end
203
- out << " rgviz_#{id}_data = new google.visualization.DataTable(#{table.to_json});\n"
192
+ if url.is_a?(Array)
193
+ out << " rgviz_#{id}_data = google.visualization.arrayToDataTable(#{url.to_json});\n"
194
+ else
195
+ executor_options = {}
196
+ executor_options[:conditions] = conditions if conditions
197
+ executor_options[:extensions] = extensions if extensions
198
+
199
+ table = if url.is_a?(Class) and url < ActiveRecord::Base
200
+ Rgviz::Executor.new(url).execute(query, executor_options)
201
+ elsif url.respond_to?(:execute)
202
+ url.execute(query, executor_options)
203
+ else
204
+ url
205
+ end
206
+ out << " rgviz_#{id}_data = new google.visualization.DataTable(#{table.to_json});\n"
207
+ end
204
208
  else
205
209
  out << " rgviz_#{id}_data = response.getDataTable();\n"
206
210
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgviz-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.58'
4
+ version: '0.59'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-26 00:00:00.000000000Z
12
+ date: 2012-01-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rgviz
16
- requirement: &70259916198240 !ruby/object:Gem::Requirement
16
+ requirement: &70318309307160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70259916198240
24
+ version_requirements: *70318309307160
25
25
  description:
26
26
  email: aborenszweig@manas.com.ar
27
27
  executables: []