diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-20 15:30:20 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-20 15:30:20 -0700 |
commit | 205e59d65bf555119070c6c059c0f229f7f4e0dd (patch) | |
tree | 9a7fc80bc22efe4382015e05de370996cb7f0f97 /lib | |
parent | 35d66b6eee3cf51c37fa38eb7010c4dec8cd13a4 (diff) | |
download | rails-205e59d65bf555119070c6c059c0f229f7f4e0dd.tar.gz rails-205e59d65bf555119070c6c059c0f229f7f4e0dd.tar.bz2 rails-205e59d65bf555119070c6c059c0f229f7f4e0dd.zip |
use OO to avoid meta programming
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/algebra/ordering.rb | 11 |
1 files changed, 5 insertions, 6 deletions
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 |