rgviz-rails 0.12 → 0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/rails/init.rb +10 -4
- metadata +3 -3
data/rails/init.rb
CHANGED
@@ -38,20 +38,26 @@ config.after_initialize do
|
|
38
38
|
options[:conditions] = conditions if conditions
|
39
39
|
table = executor.execute options
|
40
40
|
|
41
|
-
|
41
|
+
case out
|
42
|
+
when 'json'
|
42
43
|
original_render :text => "#{responseHandler}({reqId:'#{reqId}',status:'ok',version:'#{version}',table:#{table.to_json}});"
|
43
|
-
|
44
|
+
when 'html'
|
44
45
|
original_render :text => Rgviz::HtmlRenderer.render(table)
|
46
|
+
when 'csv'
|
47
|
+
original_render :text => Rgviz::CsvRenderer.render(table)
|
45
48
|
else
|
46
49
|
original_render :text => "#{responseHandler}({reqId:'#{reqId}',status:'error',version:'#{version}',errors:[{reason:'not_supported', message:'Unsupported output type: #{out}'}]});"
|
47
50
|
end
|
48
51
|
rescue ParseException => e
|
49
52
|
msg = e.message.gsub("'", "\\'")
|
50
53
|
|
51
|
-
|
54
|
+
case out
|
55
|
+
when 'json'
|
52
56
|
original_render :text => "#{responseHandler}({reqId:'#{reqId}',status:'error',version:'#{version}',errors:[{reason:'invalid_query', message:'#{msg}'}]});"
|
53
|
-
|
57
|
+
when 'html'
|
54
58
|
original_render :text => "<b>Error:</b> #{msg}"
|
59
|
+
when 'csv'
|
60
|
+
original_render :text => "Error: #{msg}"
|
55
61
|
else
|
56
62
|
original_render :text => "<b>Unsupported output type:</b> #{out}"
|
57
63
|
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:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 13
|
9
|
+
version: "0.13"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ary Borenszweig
|