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/algebra | |
parent | 29fea82cc67259974a78a5ca8872bd515c9042ae (diff) | |
download | rails-700cc8418800911aaab75e2ec1478ee958ef4df8.tar.gz rails-700cc8418800911aaab75e2ec1478ee958ef4df8.tar.bz2 rails-700cc8418800911aaab75e2ec1478ee958ef4df8.zip |
more class organization
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/relations/operations/group.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/join.rb | 13 |
2 files changed, 17 insertions, 0 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 |