aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-25 17:42:18 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-25 17:42:18 -0700
commitfaf14aeed6cc79bd356f2ac9739362b2ba5732bc (patch)
tree9a4fe784fa33524cd140d2fe81878064cb1a43cd
parent89fb88982fb1a678484cd4bdacae37aa4a599a4a (diff)
downloadrails-faf14aeed6cc79bd356f2ac9739362b2ba5732bc.tar.gz
rails-faf14aeed6cc79bd356f2ac9739362b2ba5732bc.tar.bz2
rails-faf14aeed6cc79bd356f2ac9739362b2ba5732bc.zip
more unfactoring before we refactor
-rw-r--r--lib/arel/algebra/relations/operations/skip.rb27
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/arel/algebra/relations/operations/skip.rb b/lib/arel/algebra/relations/operations/skip.rb
index 43db134ea0..f6a58d15bd 100644
--- a/lib/arel/algebra/relations/operations/skip.rb
+++ b/lib/arel/algebra/relations/operations/skip.rb
@@ -1,7 +1,28 @@
module Arel
class Skip < Compound
- attributes :relation, :skipped
- deriving :initialize, :==
- requires :skipping
+ attr_reader :relation, :skipped
+
+ def initialize relation, skipped
+ super(relation)
+ @skipped = skipped
+ end
+
+ def == other
+ super ||
+ Skip === other &&
+ relation == other.relation &&
+ skipped == other.skipped
+ end
+
+ def engine
+ engine = relation.engine
+
+ # Temporary check of whether or not the engine supports where.
+ if engine.respond_to?(:supports) && !engine.supports(:skipping)
+ Memory::Engine.new
+ else
+ engine
+ end
+ end
end
end