rgviz-rails 0.62 → 0.63
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -0
- data/lib/rgviz_rails/executor.rb +2 -2
- data/lib/rgviz_rails/parser.rb +23 -0
- data/lib/rgviz_rails/view_helper.rb +1 -1
- data/lib/rgviz_rails.rb +5 -15
- metadata +6 -5
data/README.rdoc
CHANGED
@@ -118,9 +118,14 @@ You can also apply a query over an array of arrays that contains your "records"
|
|
118
118
|
This is very useful if you need to present visualizations against data coming from a CSV file.
|
119
119
|
|
120
120
|
=== Current Limitations
|
121
|
+
|
121
122
|
* The *format* clause works, but formatting is as in ruby (like "%.2f" for numbers, "foo %s bar" for strings, and "%Y-%m-%d" for dates, as specified by Time#strftime)
|
122
123
|
* Only supports MySQL, PostgreSQL and SQLite adapters
|
123
124
|
* These scalar functions are not supported for SQLite: *millisecond*, *quarter*
|
124
125
|
* These scalar functions are not supported for MySQL: *millisecond*
|
125
126
|
* The function *toDate* doesn't accept a number as its argument
|
126
127
|
* The *tsv* output format is not supported
|
128
|
+
|
129
|
+
=== Contributors
|
130
|
+
|
131
|
+
* {Brad Seefeld}[https://github.com/bradseefeld]
|
data/lib/rgviz_rails/executor.rb
CHANGED
@@ -27,8 +27,8 @@ module Rgviz
|
|
27
27
|
|
28
28
|
def execute(query, options = {})
|
29
29
|
@query = query
|
30
|
-
@query = Parser.parse(@query, options) unless @query.kind_of?(Query)
|
31
|
-
|
30
|
+
@query = RgvizRails::Parser.parse(@query, options) unless @query.kind_of?(Query)
|
31
|
+
|
32
32
|
@table = Table.new
|
33
33
|
@extra_conditions = options[:conditions]
|
34
34
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RgvizRails
|
2
|
+
class Parser < Rgviz::Parser
|
3
|
+
def self.parse(string, options = {})
|
4
|
+
new(string, options).parse
|
5
|
+
end
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def parse_time(time_string)
|
10
|
+
time = Time.parse(time_string)
|
11
|
+
|
12
|
+
# Honor the user's time zone if possible. We add the offset instead of using
|
13
|
+
# Time.zone.parse because we do not want a TimeWithZone object. TimeWithZone is not
|
14
|
+
# formatted as UTC when its used in ActiveRecord. We want the UTC
|
15
|
+
# (or system time zone time) time for the given local time.
|
16
|
+
if Time.zone
|
17
|
+
time -= Time.zone.utc_offset.seconds
|
18
|
+
end
|
19
|
+
|
20
|
+
time
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -87,7 +87,7 @@ module Rgviz
|
|
87
87
|
url = url_for url unless custom_executor
|
88
88
|
|
89
89
|
# Parse the query
|
90
|
-
query = Parser.parse query, :extensions => extensions
|
90
|
+
query = RgvizRails::Parser.parse query, :extensions => extensions
|
91
91
|
|
92
92
|
# And replace the html_ and javascript_ magic names
|
93
93
|
query.accept visitor
|
data/lib/rgviz_rails.rb
CHANGED
@@ -1,18 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
|
7
|
-
class Rgviz::Parser
|
8
|
-
def parse_time(string)
|
9
|
-
Time.zone.parse string
|
10
|
-
end
|
11
|
-
|
12
|
-
def parse_date(string)
|
13
|
-
parse_time(string).to_date
|
14
|
-
end
|
15
|
-
end
|
1
|
+
require "rgviz_rails/init"
|
2
|
+
require "rgviz_rails/executor"
|
3
|
+
require "rgviz_rails/js_renderer"
|
4
|
+
require "rgviz_rails/tqx"
|
5
|
+
require "rgviz_rails/parser"
|
16
6
|
|
17
7
|
module RgvizRails
|
18
8
|
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.
|
4
|
+
version: '0.63'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-09 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rgviz
|
16
|
-
requirement: &
|
16
|
+
requirement: &70146916819240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.43'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70146916819240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &70146916818740 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70146916818740
|
36
36
|
description:
|
37
37
|
email: aborenszweig@manas.com.ar
|
38
38
|
executables: []
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/rgviz_rails.rb
|
44
44
|
- lib/rgviz_rails/executor.rb
|
45
45
|
- lib/rgviz_rails/js_renderer.rb
|
46
|
+
- lib/rgviz_rails/parser.rb
|
46
47
|
- lib/rgviz_rails/tqx.rb
|
47
48
|
- lib/rgviz_rails/view_helper.rb
|
48
49
|
- lib/rgviz_rails/adapters/mysql_adapter.rb
|