arel 4.0.0.beta1 → 4.0.0.beta2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bffeca2f74de102b93f79a39be17415ef98399f
4
- data.tar.gz: ebd8a4b403109325f511a917ade3a8ea79a86292
3
+ metadata.gz: f4264ab4b4e747b29ec7a97c5d54f79f95ef15db
4
+ data.tar.gz: 9122058016114dc381291e8d66d62fcd1327bdb6
5
5
  SHA512:
6
- metadata.gz: 8c2e5369682dc3fd3ed0d0ebc8336ce5a4d0ad8f0436ccbc49c5c741cad6c7601fd13d36906319260ddc184270f2bfd6712d3024d1bf144c1fcb5378327caf64
7
- data.tar.gz: 69c8070216e4a9ed581a0ff084710c20d5152051d8be144a4e51351fa6c8215373c692301c847fee61eec88c8aa764914ec919208b635a8388368031e6f2c3c9
6
+ metadata.gz: 24d225c695b37c2a1923ff2460ab13a0711fb2659f1440ca3ef898e6bd6cb7cd65ee6001af10d013b4c6d6e7cd41aa983ef48011df036f1db76e868fc2b04695
7
+ data.tar.gz: d836640d595a871b8bcb23410ae28412604f51c396ffc3da56017c38af2503bcac1ebe898807a77ab3377390eba48fafb4396856b2d22ed16377f26aa19f07c6
data/.travis.yml CHANGED
@@ -1,12 +1,10 @@
1
1
  script: "rake test"
2
2
  rvm:
3
- - 1.8.7
4
- - rbx-18mode
5
3
  - rbx-19mode
6
4
  - jruby
7
5
  - 1.9.2
8
6
  - 1.9.3
9
- - ruby-head
7
+ - 2.0.0
10
8
  notifications:
11
9
  email: false
12
10
  irc:
data/Gemfile CHANGED
@@ -5,7 +5,7 @@
5
5
  source :gemcutter
6
6
 
7
7
 
8
- gem "minitest", "~>4.3.3", :group => [:development, :test]
8
+ gem "minitest", "~>4.6.2", :group => [:development, :test]
9
9
  gem "hoe", "~>3.3.1", :group => [:development, :test]
10
10
 
11
11
  # vim: syntax=ruby
data/arel.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "arel"
5
- s.version = "4.0.0.beta1.20130225132415"
5
+ s.version = "4.0.0.beta2.20130314230643"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Aaron Patterson", "Bryan Halmkamp", "Emilio Tagua", "Nick Kallen"]
9
- s.date = "2013-02-25"
9
+ s.date = "2013-03-15"
10
10
  s.description = "Arel is a SQL AST manager for Ruby. It\n\n1. Simplifies the generation of complex SQL queries\n2. Adapts to various RDBMS systems\n\nIt is intended to be a framework framework; that is, you can build your own ORM\nwith it, focusing on innovative object and collection modeling as opposed to\ndatabase compatibility and query generation."
11
11
  s.email = ["aaron@tenderlovemaking.com", "bryan@brynary.com", "miloops@gmail.com", "nick@example.org"]
12
12
  s.extra_rdoc_files = ["History.txt", "MIT-LICENSE.txt", "Manifest.txt", "README.markdown"]
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.rdoc_options = ["--main", "README.markdown"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = "arel"
18
- s.rubygems_version = "2.0.0"
18
+ s.rubygems_version = "2.0.2"
19
19
  s.summary = "Arel is a SQL AST manager for Ruby"
20
20
  s.test_files = ["test/attributes/test_attribute.rb", "test/nodes/test_and.rb", "test/nodes/test_as.rb", "test/nodes/test_ascending.rb", "test/nodes/test_bin.rb", "test/nodes/test_count.rb", "test/nodes/test_delete_statement.rb", "test/nodes/test_descending.rb", "test/nodes/test_distinct.rb", "test/nodes/test_equality.rb", "test/nodes/test_extract.rb", "test/nodes/test_false.rb", "test/nodes/test_grouping.rb", "test/nodes/test_infix_operation.rb", "test/nodes/test_insert_statement.rb", "test/nodes/test_named_function.rb", "test/nodes/test_node.rb", "test/nodes/test_not.rb", "test/nodes/test_or.rb", "test/nodes/test_over.rb", "test/nodes/test_select_core.rb", "test/nodes/test_select_statement.rb", "test/nodes/test_sql_literal.rb", "test/nodes/test_sum.rb", "test/nodes/test_table_alias.rb", "test/nodes/test_true.rb", "test/nodes/test_update_statement.rb", "test/nodes/test_window.rb", "test/test_activerecord_compat.rb", "test/test_attributes.rb", "test/test_crud.rb", "test/test_delete_manager.rb", "test/test_factory_methods.rb", "test/test_insert_manager.rb", "test/test_select_manager.rb", "test/test_table.rb", "test/test_update_manager.rb", "test/visitors/test_bind_visitor.rb", "test/visitors/test_depth_first.rb", "test/visitors/test_dot.rb", "test/visitors/test_ibm_db.rb", "test/visitors/test_informix.rb", "test/visitors/test_join_sql.rb", "test/visitors/test_mssql.rb", "test/visitors/test_mysql.rb", "test/visitors/test_oracle.rb", "test/visitors/test_postgres.rb", "test/visitors/test_sqlite.rb", "test/visitors/test_to_sql.rb"]
21
21
 
data/lib/arel.rb CHANGED
@@ -32,7 +32,7 @@ require 'arel/sql_literal'
32
32
  ####
33
33
 
34
34
  module Arel
35
- VERSION = '4.0.0.beta1'
35
+ VERSION = '4.0.0.beta2'
36
36
 
37
37
  def self.sql raw_sql
38
38
  Arel::Nodes::SqlLiteral.new raw_sql
@@ -29,7 +29,15 @@ module Arel
29
29
  when Arel::SelectManager
30
30
  Arel::Nodes::In.new(self, other.ast)
31
31
  when Range
32
- if other.exclude_end?
32
+ if other.begin == -Float::INFINITY && other.end == Float::INFINITY
33
+ Nodes::NotIn.new self, []
34
+ elsif other.end == Float::INFINITY
35
+ Nodes::GreaterThanOrEqual.new(self, other.begin)
36
+ elsif other.begin == -Float::INFINITY && other.exclude_end?
37
+ Nodes::LessThan.new(self, other.end)
38
+ elsif other.begin == -Float::INFINITY
39
+ Nodes::LessThanOrEqual.new(self, other.end)
40
+ elsif other.exclude_end?
33
41
  left = Nodes::GreaterThanOrEqual.new(self, other.begin)
34
42
  right = Nodes::LessThan.new(self, other.end)
35
43
  Nodes::And.new [left, right]
@@ -54,7 +62,15 @@ module Arel
54
62
  when Arel::SelectManager
55
63
  Arel::Nodes::NotIn.new(self, other.ast)
56
64
  when Range
57
- if other.exclude_end?
65
+ if other.begin == -Float::INFINITY && other.end == Float::INFINITY
66
+ Nodes::In.new self, []
67
+ elsif other.end == Float::INFINITY
68
+ Nodes::LessThan.new(self, other.begin)
69
+ elsif other.begin == -Float::INFINITY && other.exclude_end?
70
+ Nodes::GreaterThanOrEqual.new(self, other.end)
71
+ elsif other.begin == -Float::INFINITY
72
+ Nodes::GreaterThan.new(self, other.end)
73
+ elsif other.exclude_end?
58
74
  left = Nodes::LessThan.new(self, other.begin)
59
75
  right = Nodes::GreaterThanOrEqual.new(self, other.end)
60
76
  Nodes::Or.new left, right
@@ -147,11 +147,11 @@ key on UpdateManager using UpdateManager#key=
147
147
 
148
148
  return nil unless table_exists? table
149
149
 
150
- column_cache[table][name]
150
+ column_cache(table)[name]
151
151
  end
152
152
 
153
- def column_cache
154
- @schema_cache.columns_hash
153
+ def column_cache(table)
154
+ @schema_cache.columns_hash(table)
155
155
  end
156
156
 
157
157
  def visit_Arel_Nodes_Values o
@@ -3,7 +3,7 @@ module FakeRecord
3
3
  end
4
4
 
5
5
  class Connection
6
- attr_reader :tables, :columns_hash
6
+ attr_reader :tables
7
7
  attr_accessor :visitor
8
8
 
9
9
  def initialize(visitor = nil)
@@ -31,6 +31,10 @@ module FakeRecord
31
31
  @visitor = visitor
32
32
  end
33
33
 
34
+ def columns_hash table_name
35
+ @columns_hash[table_name]
36
+ end
37
+
34
38
  def primary_key name
35
39
  @primary_keys[name.to_s]
36
40
  end
@@ -230,6 +230,23 @@ module Arel
230
230
  }
231
231
  end
232
232
 
233
+ it 'can handle ranges bounded by infinity' do
234
+ node = @attr.in 1..Float::INFINITY
235
+ @visitor.accept(node).must_be_like %{
236
+ "users"."id" >= 1
237
+ }
238
+ node = @attr.in(-Float::INFINITY..3)
239
+ @visitor.accept(node).must_be_like %{
240
+ "users"."id" <= 3
241
+ }
242
+ node = @attr.in(-Float::INFINITY...3)
243
+ @visitor.accept(node).must_be_like %{
244
+ "users"."id" < 3
245
+ }
246
+ node = @attr.in(-Float::INFINITY..Float::INFINITY)
247
+ @visitor.accept(node).must_be_like %{1=1}
248
+ end
249
+
233
250
  it 'can handle subqueries' do
234
251
  table = Table.new(:users)
235
252
  subquery = table.project(:id).where(table[:name].eq('Aaron'))
@@ -316,6 +333,23 @@ module Arel
316
333
  }
317
334
  end
318
335
 
336
+ it 'can handle ranges bounded by infinity' do
337
+ node = @attr.not_in 1..Float::INFINITY
338
+ @visitor.accept(node).must_be_like %{
339
+ "users"."id" < 1
340
+ }
341
+ node = @attr.not_in(-Float::INFINITY..3)
342
+ @visitor.accept(node).must_be_like %{
343
+ "users"."id" > 3
344
+ }
345
+ node = @attr.not_in(-Float::INFINITY...3)
346
+ @visitor.accept(node).must_be_like %{
347
+ "users"."id" >= 3
348
+ }
349
+ node = @attr.not_in(-Float::INFINITY..Float::INFINITY)
350
+ @visitor.accept(node).must_be_like %{1=0}
351
+ end
352
+
319
353
  it 'can handle subqueries' do
320
354
  table = Table.new(:users)
321
355
  subquery = table.project(:id).where(table[:name].eq('Aaron'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arel
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta1
4
+ version: 4.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-02-25 00:00:00.000000000 Z
14
+ date: 2013-03-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: minitest
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  version: 1.3.1
232
232
  requirements: []
233
233
  rubyforge_project: arel
234
- rubygems_version: 2.0.0
234
+ rubygems_version: 2.0.2
235
235
  signing_key:
236
236
  specification_version: 4
237
237
  summary: Arel is a SQL AST manager for Ruby