aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/operations/order.rb
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-19 14:08:42 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-19 14:08:42 -0700
commite8966bf9a86afb82c658cedd7e4baffa3a15a856 (patch)
tree8705c27da734888b2ca9713182ac3a837026cb99 /lib/arel/relations/operations/order.rb
parent518db17ca3dade07fc67b6044b63c826cefb1442 (diff)
downloadrails-e8966bf9a86afb82c658cedd7e4baffa3a15a856.tar.gz
rails-e8966bf9a86afb82c658cedd7e4baffa3a15a856.tar.bz2
rails-e8966bf9a86afb82c658cedd7e4baffa3a15a856.zip
reorganized file structure
Diffstat (limited to 'lib/arel/relations/operations/order.rb')
-rw-r--r--lib/arel/relations/operations/order.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/arel/relations/operations/order.rb b/lib/arel/relations/operations/order.rb
new file mode 100644
index 0000000000..ebb4dc0668
--- /dev/null
+++ b/lib/arel/relations/operations/order.rb
@@ -0,0 +1,19 @@
+module Arel
+ class Order < Compound
+ attr_reader :orderings
+
+ def initialize(relation, *orderings)
+ @relation, @orderings = relation, orderings.collect { |o| o.bind(relation) }
+ end
+
+ def orders
+ orderings + relation.orders
+ end
+
+ def ==(other)
+ Order === other and
+ relation == other.relation and
+ orderings == other.orderings
+ end
+ end
+end \ No newline at end of file