arel 2.2.0 → 2.2.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.
@@ -0,0 +1,13 @@
1
+ script: "rake test"
2
+ rvm:
3
+ - 1.8.7
4
+ - rbx
5
+ - rbx-2.0
6
+ - jruby
7
+ - 1.9.2
8
+ - 1.9.3
9
+ - ruby-head
10
+ notifications:
11
+ email: false
12
+ irc:
13
+ - "irc.freenode.org#rails-contrib"
@@ -1,3 +1,11 @@
1
+ == 2.2.1 / 2011-09-15
2
+
3
+ * Enhancements
4
+
5
+ * Added UpdateManager#key to access the key value
6
+ * Added SelectManager#projections= to override any existing projections
7
+ * Added SelectManager#source to get the source of the last select core in the AST
8
+
1
9
  == 2.2.0 / 2011-08-09
2
10
 
3
11
  * Bug Fixes
@@ -166,7 +174,7 @@
166
174
 
167
175
  == 2.0.0 / 2010-08-01
168
176
  * Enhancements
169
-
177
+
170
178
  * Recreate library using the Visitor pattern.
171
179
  http://en.wikipedia.org/wiki/Visitor_pattern
172
180
 
@@ -1,5 +1,6 @@
1
1
  .autotest
2
2
  .gemtest
3
+ .travis.yml
3
4
  Gemfile
4
5
  History.txt
5
6
  MIT-LICENSE.txt
@@ -33,7 +33,7 @@ require 'arel/sql_literal'
33
33
  ####
34
34
 
35
35
  module Arel
36
- VERSION = '2.2.0'
36
+ VERSION = '2.2.1'
37
37
 
38
38
  def self.sql raw_sql
39
39
  Arel::Nodes::SqlLiteral.new raw_sql
@@ -135,6 +135,10 @@ module Arel
135
135
  self
136
136
  end
137
137
 
138
+ def projections= projections
139
+ @ctx.projections = projections
140
+ end
141
+
138
142
  def order *expr
139
143
  # FIXME: We SHOULD NOT be converting these to SqlLiteral automatically
140
144
  @ast.orders.concat expr.map { |x|
@@ -220,6 +224,10 @@ module Arel
220
224
  @ctx.source.right
221
225
  end
222
226
 
227
+ def source
228
+ @ctx.source
229
+ end
230
+
223
231
  def joins manager
224
232
  if $VERBOSE
225
233
  warn "joins is deprecated and will be removed in 3.0.0"
@@ -15,6 +15,10 @@ module Arel
15
15
  @ast.key = key
16
16
  end
17
17
 
18
+ def key
19
+ @ast.key
20
+ end
21
+
18
22
  def order *expr
19
23
  @ast.orders = expr
20
24
  self
@@ -860,6 +860,15 @@ module Arel
860
860
  end
861
861
  end
862
862
 
863
+ describe 'projections=' do
864
+ it 'overwrites projections' do
865
+ manager = Arel::SelectManager.new Table.engine
866
+ manager.project Arel.sql('foo')
867
+ manager.projections = [Arel.sql('bar')]
868
+ manager.to_sql.must_be_like %{ SELECT bar }
869
+ end
870
+ end
871
+
863
872
  describe 'take' do
864
873
  it "knows take" do
865
874
  table = Table.new :users
@@ -947,5 +956,13 @@ module Arel
947
956
  manager.to_sql.must_be_like 'SELECT "users"."id" FROM "users"'
948
957
  end
949
958
  end
959
+
960
+ describe 'source' do
961
+ it 'returns the join source of the select core' do
962
+ table = Table.new :users
963
+ manager = Arel::SelectManager.new Table.engine
964
+ manager.source.must_equal manager.ast.cores.last.source
965
+ end
966
+ end
950
967
  end
951
968
  end
@@ -95,5 +95,21 @@ module Arel
95
95
  um.where(table[:id].eq(1)).must_equal um
96
96
  end
97
97
  end
98
+
99
+ describe 'key' do
100
+ before do
101
+ @table = Table.new :users
102
+ @um = Arel::UpdateManager.new Table.engine
103
+ @um.key = @table[:foo]
104
+ end
105
+
106
+ it 'can be set' do
107
+ @um.ast.key.must_equal @table[:foo]
108
+ end
109
+
110
+ it 'can be accessed' do
111
+ @um.key.must_equal @table[:foo]
112
+ end
113
+ end
98
114
  end
99
115
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 2
8
- - 0
9
- version: 2.2.0
8
+ - 1
9
+ version: 2.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aaron Patterson
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-08-09 00:00:00 -07:00
20
+ date: 2011-08-15 00:00:00 -07:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -72,6 +72,7 @@ extra_rdoc_files:
72
72
  files:
73
73
  - .autotest
74
74
  - .gemtest
75
+ - .travis.yml
75
76
  - Gemfile
76
77
  - History.txt
77
78
  - MIT-LICENSE.txt