From 205e59d65bf555119070c6c059c0f229f7f4e0dd Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 20 Jul 2010 15:30:20 -0700 Subject: use OO to avoid meta programming --- lib/arel/algebra/ordering.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/arel/algebra/ordering.rb b/lib/arel/algebra/ordering.rb index 8439e937a9..984327aaf7 100644 --- a/lib/arel/algebra/ordering.rb +++ b/lib/arel/algebra/ordering.rb @@ -1,5 +1,5 @@ module Arel - class Ordering + class Ordering < Struct.new(:attribute) delegate :relation, :to => :attribute def bind(relation) @@ -9,15 +9,14 @@ module Arel def to_ordering self end + + def == other + super || (self.class === other && attribute == other.attribute) + end end class Ascending < Ordering - attributes :attribute - deriving :initialize, :== end - class Descending < Ordering - attributes :attribute - deriving :initialize, :== end end -- cgit v1.2.3