arel_ruby 0.0.1.pre → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,16 +4,10 @@ require 'date'
4
4
  module Arel
5
5
  module Visitors
6
6
  class Ruby < Arel::Visitors::Visitor
7
- attr_accessor :last_column
8
-
9
7
  def initialize
10
8
  @connection = Object.new.extend(ActiveRecord::ConnectionAdapters::Quoting)
11
9
  @chains = []
12
- end
13
-
14
- def accept object
15
- self.last_column = nil
16
- super
10
+ @dummy_column = Struct.new(:type).new
17
11
  end
18
12
 
19
13
  private
@@ -47,6 +41,7 @@ module Arel
47
41
  ("#{o.orders.map { |x| visit_Arel_Nodes_OrderCore x }.join('.')}" unless o.orders.empty?),
48
42
  (visit(o.offset) if o.offset),
49
43
  (visit(o.limit) if o.limit),
44
+ o.cores.map { |x| x.groups.map { |x| visit x}.join '.' }.flatten.join,
50
45
  ].compact.delete_if {|e| e.respond_to?(:empty?) && e.empty? }.join '.'
51
46
  end
52
47
 
@@ -55,7 +50,6 @@ module Arel
55
50
  # ("#{o.projections.map { |x| visit x }.join ', '}" unless o.projections.empty?),
56
51
  # (visit(o.source) if o.source && !o.source.empty?),
57
52
  ("#{o.wheres.map { |x| visit x }.join '.' }" unless o.wheres.empty?),
58
- ("#{o.groups.map { |x| visit x }.join '.' }" unless o.groups.empty?)
59
53
  # (visit(o.having) if o.having),
60
54
  ].compact.join '.'
61
55
  end
@@ -240,7 +234,6 @@ module Arel
240
234
 
241
235
 
242
236
  def visit_Arel_Attributes_Attribute o
243
- self.last_column = o.name
244
237
  "o.#{o.name}"
245
238
  end
246
239
  alias :visit_Arel_Attributes_Integer :visit_Arel_Attributes_Attribute
@@ -258,7 +251,7 @@ module Arel
258
251
  alias :visit_Fixnum :literal
259
252
 
260
253
  def quoted o
261
- quote(o, last_column)
254
+ quote o
262
255
  end
263
256
 
264
257
  alias :visit_ActiveSupport_Multibyte_Chars :quoted
@@ -289,8 +282,8 @@ module Arel
289
282
  # o.map { |x| visit x }.join(', ')
290
283
  # end
291
284
 
292
- def quote value, column = nil
293
- @connection.quote value, column
285
+ def quote value
286
+ @connection.quote value, @dummy_column
294
287
  end
295
288
  end
296
289
  end
@@ -1,3 +1,3 @@
1
1
  module ArelRuby
2
- VERSION = "0.0.1.pre"
2
+ VERSION = '0.0.1'
3
3
  end
metadata CHANGED
@@ -1,78 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: arel_ruby
3
- version: !ruby/object:Gem::Version
4
- hash: 2107825352
5
- prerelease: 6
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- - pre
11
- version: 0.0.1.pre
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
12
6
  platform: ruby
13
- authors:
7
+ authors:
14
8
  - Akira Matsuda
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2012-07-06 00:00:00 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
20
13
  dependencies: []
21
-
22
14
  description: ARel Ruby visitor
23
- email:
15
+ email:
24
16
  - ronnie@dio.jp
25
17
  executables: []
26
-
27
18
  extensions: []
28
-
29
19
  extra_rdoc_files: []
30
-
31
- files:
20
+ files:
32
21
  - .gitignore
33
22
  - Gemfile
34
23
  - MIT-LICENSE
35
24
  - README.md
36
25
  - Rakefile
37
26
  - arel_ruby.gemspec
27
+ - examples/active_record.rb
38
28
  - lib/arel/visitors/ruby.rb
39
29
  - lib/arel_ruby.rb
40
30
  - lib/arel_ruby/version.rb
41
- - lib/examples/active_record.rb
42
31
  homepage: https://github.com/amatsuda/arel_ruby
43
32
  licenses: []
44
-
45
33
  post_install_message:
46
34
  rdoc_options: []
47
-
48
- require_paths:
35
+ require_paths:
49
36
  - lib
50
- required_ruby_version: !ruby/object:Gem::Requirement
37
+ required_ruby_version: !ruby/object:Gem::Requirement
51
38
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
- version: "0"
59
- required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
44
  none: false
61
- requirements:
62
- - - ">"
63
- - !ruby/object:Gem::Version
64
- hash: 25
65
- segments:
66
- - 1
67
- - 3
68
- - 1
69
- version: 1.3.1
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
70
49
  requirements: []
71
-
72
50
  rubyforge_project:
73
- rubygems_version: 1.8.10
51
+ rubygems_version: 1.8.24
74
52
  signing_key:
75
53
  specification_version: 3
76
54
  summary: ARel Ruby visitor
77
55
  test_files: []
78
-