rgviz-rails 0.73 → 0.74

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,4 +36,8 @@ module RgvizRails
36
36
  end
37
37
  time
38
38
  end
39
+
40
+ def self.inherits_from_active_record(obj)
41
+ (obj.is_a?(Class) && obj < ActiveRecord::Base) || obj.is_a?(ActiveRecord::Relation)
42
+ end
39
43
  end
@@ -24,7 +24,7 @@ module Rgviz
24
24
  options[:conditions] = conditions if conditions
25
25
  options[:virtual_columns] = virtual_columns if virtual_columns
26
26
 
27
- table = if model.is_a?(Class) && model < ActiveRecord::Base
27
+ table = if RgvizRails.inherits_from_active_record(model)
28
28
  Rgviz::Executor.new(model).execute query, options
29
29
  elsif model.respond_to? :execute
30
30
  model.execute query, options
@@ -88,7 +88,7 @@ module Rgviz
88
88
  raise "Must specify a :kind" unless kind
89
89
  raise "Must specify a :url" unless url
90
90
 
91
- custom_executor = (url.is_a?(Class) and url < ActiveRecord::Base) || url.respond_to?(:execute) || url.is_a?(Rgviz::Table) || url.is_a?(Array)
91
+ custom_executor = RgvizRails.inherits_from_active_record(url) || url.respond_to?(:execute) || url.is_a?(Rgviz::Table) || url.is_a?(Array)
92
92
  url = url_for url unless custom_executor
93
93
 
94
94
  # Parse the query
@@ -195,7 +195,7 @@ module Rgviz
195
195
  executor_options[:conditions] = conditions if conditions
196
196
  executor_options[:virtual_columns] = virtual_columns if virtual_columns
197
197
 
198
- table = if url.is_a?(Class) and url < ActiveRecord::Base
198
+ table = if RgvizRails.inherits_from_active_record(url)
199
199
  Rgviz::Executor.new(url).execute(query, executor_options)
200
200
  elsif url.respond_to?(:execute)
201
201
  url.execute(query, executor_options)
metadata CHANGED
@@ -1,45 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rgviz-rails
3
- version: !ruby/object:Gem::Version
4
- version: '0.73'
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 74
8
+ version: "0.74"
6
9
  platform: ruby
7
- authors:
10
+ authors:
8
11
  - Ary Borenszweig
9
12
  autorequire:
10
13
  bindir: bin
11
14
  cert_chain: []
12
- date: 2012-08-15 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
+
16
+ date: 2012-08-29 00:00:00 -03:00
17
+ default_executable:
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
15
20
  name: rgviz
16
- requirement: &70257227777720 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0.46'
22
- type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70257227777720
25
- - !ruby/object:Gem::Dependency
26
- name: rails
27
- requirement: &70257227776920 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 0
28
+ - 46
29
+ version: "0.46"
33
30
  type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: rails
34
34
  prerelease: false
35
- version_requirements: *70257227776920
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
36
44
  description:
37
45
  email: aborenszweig@manas.com.ar
38
46
  executables: []
47
+
39
48
  extensions: []
40
- extra_rdoc_files:
49
+
50
+ extra_rdoc_files:
41
51
  - README.markdown
42
- files:
52
+ files:
43
53
  - lib/rgviz_rails.rb
44
54
  - lib/rgviz_rails/executor.rb
45
55
  - lib/rgviz_rails/js_renderer.rb
@@ -52,28 +62,35 @@ files:
52
62
  - lib/rgviz_rails/init.rb
53
63
  - rails/init.rb
54
64
  - README.markdown
65
+ has_rdoc: false
55
66
  homepage: http://github.com/asterite/rgviz-rails
56
67
  licenses: []
68
+
57
69
  post_install_message:
58
70
  rdoc_options: []
59
- require_paths:
71
+
72
+ require_paths:
60
73
  - lib
61
- required_ruby_version: !ruby/object:Gem::Requirement
62
- none: false
63
- requirements:
64
- - - ! '>='
65
- - !ruby/object:Gem::Version
66
- version: '0'
67
- required_rubygems_version: !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ! '>='
71
- - !ruby/object:Gem::Version
72
- version: '0'
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
87
+ version: "0"
73
88
  requirements: []
89
+
74
90
  rubyforge_project:
75
- rubygems_version: 1.8.10
91
+ rubygems_version: 1.3.6
76
92
  signing_key:
77
93
  specification_version: 3
78
94
  summary: rgviz for rails
79
95
  test_files: []
96
+