aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/ordering.rb
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-09-30 23:35:23 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-09-30 23:35:23 -0400
commit71d65b7571d5ff01e0de3c08a9396dc1e1386118 (patch)
treeb7ddf3e7130da3741d60db33c64b06d798f014fd /lib/arel/algebra/ordering.rb
parentbcd8ffa2183a1ca98417fb39bbd83e8f69c984c8 (diff)
downloadrails-71d65b7571d5ff01e0de3c08a9396dc1e1386118.tar.gz
rails-71d65b7571d5ff01e0de3c08a9396dc1e1386118.tar.bz2
rails-71d65b7571d5ff01e0de3c08a9396dc1e1386118.zip
Pull primitives up one level
Diffstat (limited to 'lib/arel/algebra/ordering.rb')
-rw-r--r--lib/arel/algebra/ordering.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/arel/algebra/ordering.rb b/lib/arel/algebra/ordering.rb
new file mode 100644
index 0000000000..8439e937a9
--- /dev/null
+++ b/lib/arel/algebra/ordering.rb
@@ -0,0 +1,23 @@
+module Arel
+ class Ordering
+ delegate :relation, :to => :attribute
+
+ def bind(relation)
+ self.class.new(attribute.bind(relation))
+ end
+
+ def to_ordering
+ self
+ end
+ end
+
+ class Ascending < Ordering
+ attributes :attribute
+ deriving :initialize, :==
+ end
+
+ class Descending < Ordering
+ attributes :attribute
+ deriving :initialize, :==
+ end
+end