diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-26 14:15:37 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-26 14:15:37 -0700 |
commit | 700cc8418800911aaab75e2ec1478ee958ef4df8 (patch) | |
tree | 80e5a84d39e5e74637369e3ad80efc68cbaf0517 /lib/arel | |
parent | 29fea82cc67259974a78a5ca8872bd515c9042ae (diff) | |
download | rails-700cc8418800911aaab75e2ec1478ee958ef4df8.tar.gz rails-700cc8418800911aaab75e2ec1478ee958ef4df8.tar.bz2 rails-700cc8418800911aaab75e2ec1478ee958ef4df8.zip |
more class organization
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/algebra/relations/operations/group.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/join.rb | 13 | ||||
-rw-r--r-- | lib/arel/engines/memory/relations/operations.rb | 21 |
3 files changed, 17 insertions, 21 deletions
diff --git a/lib/arel/algebra/relations/operations/group.rb b/lib/arel/algebra/relations/operations/group.rb index 68c626e917..af0d3c6808 100644 --- a/lib/arel/algebra/relations/operations/group.rb +++ b/lib/arel/algebra/relations/operations/group.rb @@ -14,5 +14,9 @@ module Arel @relation == other.relation && @groupings == other.groupings end + + def eval + raise NotImplementedError + end end end diff --git a/lib/arel/algebra/relations/operations/join.rb b/lib/arel/algebra/relations/operations/join.rb index 9eee84113a..5d19873f62 100644 --- a/lib/arel/algebra/relations/operations/join.rb +++ b/lib/arel/algebra/relations/operations/join.rb @@ -53,6 +53,19 @@ module Arel # FIXME remove this. :'( alias :eql? :== + + def eval + result = [] + relation1.call.each do |row1| + relation2.call.each do |row2| + combined_row = row1.combine(row2, self) + if predicates.all? { |p| p.eval(combined_row) } + result << combined_row + end + end + end + result + end end class InnerJoin < Join; end diff --git a/lib/arel/engines/memory/relations/operations.rb b/lib/arel/engines/memory/relations/operations.rb index f233c48db0..8ab6f08ab0 100644 --- a/lib/arel/engines/memory/relations/operations.rb +++ b/lib/arel/engines/memory/relations/operations.rb @@ -5,12 +5,6 @@ module Arel end end - class Group < Compound - def eval - raise NotImplementedError - end - end - class Alias < Compound include Recursion::BaseCase @@ -18,19 +12,4 @@ module Arel unoperated_rows end end - - class Join - def eval - result = [] - relation1.call.each do |row1| - relation2.call.each do |row2| - combined_row = row1.combine(row2, self) - if predicates.all? { |p| p.eval(combined_row) } - result << combined_row - end - end - end - result - end - end end |