arel 0.3.3 → 0.4.0

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.
Files changed (54) hide show
  1. data/lib/arel/algebra.rb +1 -0
  2. data/lib/arel/algebra/attributes.rb +1 -1
  3. data/lib/arel/algebra/attributes/attribute.rb +95 -7
  4. data/lib/arel/algebra/attributes/integer.rb +1 -1
  5. data/lib/arel/algebra/core_extensions/object.rb +0 -13
  6. data/lib/arel/algebra/header.rb +67 -0
  7. data/lib/arel/algebra/predicates.rb +153 -7
  8. data/lib/arel/algebra/relations/operations/having.rb +11 -7
  9. data/lib/arel/algebra/relations/operations/join.rb +1 -2
  10. data/lib/arel/algebra/relations/operations/project.rb +1 -1
  11. data/lib/arel/algebra/relations/relation.rb +13 -22
  12. data/lib/arel/algebra/relations/utilities/compound.rb +5 -1
  13. data/lib/arel/algebra/relations/utilities/externalization.rb +1 -1
  14. data/lib/arel/engines/memory/predicates.rb +58 -2
  15. data/lib/arel/engines/memory/relations/array.rb +6 -3
  16. data/lib/arel/engines/memory/relations/operations.rb +1 -1
  17. data/lib/arel/engines/sql/attributes.rb +1 -1
  18. data/lib/arel/engines/sql/core_extensions/array.rb +4 -0
  19. data/lib/arel/engines/sql/core_extensions/nil_class.rb +4 -0
  20. data/lib/arel/engines/sql/core_extensions/object.rb +4 -0
  21. data/lib/arel/engines/sql/core_extensions/range.rb +4 -0
  22. data/lib/arel/engines/sql/predicates.rb +48 -2
  23. data/lib/arel/engines/sql/primitives.rb +8 -0
  24. data/lib/arel/engines/sql/relations/compiler.rb +2 -2
  25. data/lib/arel/engines/sql/relations/operations/join.rb +1 -1
  26. data/lib/arel/engines/sql/relations/relation.rb +4 -0
  27. data/lib/arel/engines/sql/relations/table.rb +8 -4
  28. data/lib/arel/version.rb +1 -1
  29. data/spec/algebra/unit/relations/join_spec.rb +1 -2
  30. data/spec/algebra/unit/relations/table_spec.rb +1 -1
  31. data/spec/attributes/boolean_spec.rb +1 -1
  32. data/spec/attributes/float_spec.rb +1 -1
  33. data/spec/attributes/header_spec.rb +42 -0
  34. data/spec/attributes/integer_spec.rb +1 -1
  35. data/spec/attributes/string_spec.rb +1 -1
  36. data/spec/attributes/time_spec.rb +4 -2
  37. data/spec/engines/memory/integration/joins/cross_engine_spec.rb +3 -4
  38. data/spec/engines/sql/unit/predicates/in_spec.rb +23 -5
  39. data/spec/engines/sql/unit/predicates/noteq_spec.rb +75 -0
  40. data/spec/engines/sql/unit/primitives/attribute_spec.rb +0 -19
  41. data/spec/engines/sql/unit/relations/having_spec.rb +33 -0
  42. data/spec/relations/join_spec.rb +5 -3
  43. data/spec/relations/relation_spec.rb +2 -2
  44. data/spec/shared/relation_spec.rb +126 -13
  45. data/spec/support/check.rb +1 -1
  46. data/spec/support/connections/mysql_connection.rb +1 -1
  47. data/spec/support/connections/oracle_connection.rb +1 -1
  48. data/spec/support/connections/postgresql_connection.rb +1 -1
  49. data/spec/support/guards.rb +1 -1
  50. data/spec/support/matchers.rb +1 -1
  51. data/spec/support/matchers/be_like.rb +3 -3
  52. data/spec/support/matchers/have_rows.rb +1 -1
  53. data/spec/support/model.rb +6 -2
  54. metadata +7 -4
@@ -3,4 +3,4 @@ module Check
3
3
  # See: https://rspec.lighthouseapp.com/projects/5645/tickets/504
4
4
  def check(*args)
5
5
  end
6
- end
6
+ end
@@ -11,4 +11,4 @@ ActiveRecord::Base.configurations = {
11
11
  :encoding => 'utf8',
12
12
  :database => 'arel_unit',
13
13
  }
14
- }
14
+ }
@@ -14,4 +14,4 @@ ActiveRecord::Base.configurations = {
14
14
  :password => 'arel_unit',
15
15
  :database => 'orcl',
16
16
  }
17
- }
17
+ }
@@ -10,4 +10,4 @@ ActiveRecord::Base.configurations = {
10
10
  :encoding => 'utf8',
11
11
  :database => 'arel_unit',
12
12
  }
13
- }
13
+ }
@@ -25,4 +25,4 @@ module AdapterGuards
25
25
  def valid_adapters
26
26
  %w[mysql postgresql sqlite3 oracle]
27
27
  end
28
- end
28
+ end
@@ -1,4 +1,4 @@
1
1
  require "support/matchers/be_like"
2
2
  require "support/matchers/disambiguate_attributes"
3
3
  require "support/matchers/hash_the_same_as"
4
- require "support/matchers/have_rows"
4
+ require "support/matchers/have_rows"
@@ -1,12 +1,12 @@
1
1
  module Matchers
2
2
  class BeLike
3
3
  def initialize(expected)
4
- @expected = expected
4
+ @expected = expected.gsub(/\s+/, ' ').strip
5
5
  end
6
6
 
7
7
  def matches?(actual)
8
- @actual = actual
9
- @expected.gsub(/\s+/, ' ').strip == @actual.gsub(/\s+/, ' ').strip
8
+ @actual = actual.gsub(/\s+/, ' ').strip
9
+ @expected == @actual
10
10
  end
11
11
 
12
12
  def failure_message
@@ -15,4 +15,4 @@ module Matchers
15
15
  found.compact.length == expected.length && got.compact.length == expected.length
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -25,7 +25,7 @@ module Arel
25
25
  class Model
26
26
  include Relation
27
27
 
28
- attr_reader :engine, :attributes
28
+ attr_reader :engine
29
29
 
30
30
  def self.build
31
31
  relation = new
@@ -46,6 +46,10 @@ module Arel
46
46
  @attributes << type.new(self, name)
47
47
  end
48
48
 
49
+ def attributes
50
+ Header.new(@attributes)
51
+ end
52
+
49
53
  def format(attribute, value)
50
54
  value
51
55
  end
@@ -55,4 +59,4 @@ module Arel
55
59
  insert.record
56
60
  end
57
61
  end
58
- end
62
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
8
- - 3
9
- version: 0.3.3
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bryan Helmkamp
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-03-25 00:00:00 -03:00
19
+ date: 2010-06-08 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -63,6 +63,7 @@ files:
63
63
  - lib/arel/algebra/core_extensions/symbol.rb
64
64
  - lib/arel/algebra/core_extensions.rb
65
65
  - lib/arel/algebra/expression.rb
66
+ - lib/arel/algebra/header.rb
66
67
  - lib/arel/algebra/ordering.rb
67
68
  - lib/arel/algebra/predicates.rb
68
69
  - lib/arel/algebra/relations/operations/alias.rb
@@ -181,6 +182,7 @@ test_files:
181
182
  - spec/algebra/unit/session/session_spec.rb
182
183
  - spec/attributes/boolean_spec.rb
183
184
  - spec/attributes/float_spec.rb
185
+ - spec/attributes/header_spec.rb
184
186
  - spec/attributes/integer_spec.rb
185
187
  - spec/attributes/string_spec.rb
186
188
  - spec/attributes/time_spec.rb
@@ -200,6 +202,7 @@ test_files:
200
202
  - spec/engines/sql/unit/predicates/binary_spec.rb
201
203
  - spec/engines/sql/unit/predicates/equality_spec.rb
202
204
  - spec/engines/sql/unit/predicates/in_spec.rb
205
+ - spec/engines/sql/unit/predicates/noteq_spec.rb
203
206
  - spec/engines/sql/unit/predicates/predicates_spec.rb
204
207
  - spec/engines/sql/unit/primitives/attribute_spec.rb
205
208
  - spec/engines/sql/unit/primitives/expression_spec.rb