From 700cc8418800911aaab75e2ec1478ee958ef4df8 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 26 Jul 2010 14:15:37 -0700 Subject: more class organization --- lib/arel/algebra/relations/operations/group.rb | 4 ++++ lib/arel/algebra/relations/operations/join.rb | 13 +++++++++++++ lib/arel/engines/memory/relations/operations.rb | 21 --------------------- 3 files changed, 17 insertions(+), 21 deletions(-) (limited to 'lib/arel') 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 -- cgit v1.2.3