diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 17:42:18 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-25 17:42:18 -0700 |
commit | faf14aeed6cc79bd356f2ac9739362b2ba5732bc (patch) | |
tree | 9a4fe784fa33524cd140d2fe81878064cb1a43cd | |
parent | 89fb88982fb1a678484cd4bdacae37aa4a599a4a (diff) | |
download | rails-faf14aeed6cc79bd356f2ac9739362b2ba5732bc.tar.gz rails-faf14aeed6cc79bd356f2ac9739362b2ba5732bc.tar.bz2 rails-faf14aeed6cc79bd356f2ac9739362b2ba5732bc.zip |
more unfactoring before we refactor
-rw-r--r-- | lib/arel/algebra/relations/operations/skip.rb | 27 |
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 |