rgviz-rails 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/rails/init.rb +20 -1
  2. metadata +3 -3
data/rails/init.rb CHANGED
@@ -1,3 +1,22 @@
1
1
  config.after_initialize do
2
- p "HOLA!"
2
+ module ActionControlller
3
+ class Base
4
+ def render(*args)
5
+ if args.length == 1 && args[0].kind_of?(Hash)
6
+ hash = args.first
7
+ case hash[:rgviz]
8
+ when nil then super
9
+ else
10
+ model = hash[:rgviz]
11
+ query = params[:tq]
12
+ executor = Rgviz::Executor.new model, Rgviz::Parser.new(query).parse
13
+ table = executor.execute
14
+ super :text => "google.visualization.Query.setResponse({version:'0.6',reqId:'0',status:'ok',sig:'5982206968295329967',table:#{table.to_json}});"
15
+ end
16
+ else
17
+ super
18
+ end
19
+ end
20
+ end
21
+ end
3
22
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgviz-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
- version: "0.2"
8
+ - 3
9
+ version: "0.3"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ary Borenszweig