diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-27 09:28:06 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-27 09:28:06 -0700 |
commit | d193a52dedc060e62c63fbc0c57a16ba8795f599 (patch) | |
tree | 5b31f2e9ca4cc3e35e7e85790d87b55f524ada4f /lib/arel/nodes | |
parent | 0d39cbe523206c90f4a3eaf9279f882510f375c5 (diff) | |
parent | 0c8723af70b8518c1a9ae43e650afb433e078470 (diff) | |
download | rails-d193a52dedc060e62c63fbc0c57a16ba8795f599.tar.gz rails-d193a52dedc060e62c63fbc0c57a16ba8795f599.tar.bz2 rails-d193a52dedc060e62c63fbc0c57a16ba8795f599.zip |
Merge branch 'master' into Khronos/master
* master:
visitors can define their own cache strategy for dispatch. fixes #57
Break Ordering into Ascending/Descending nodes, allow reversal
remove unnecessary guarding agains literal
LIMIT and OFFSET support for MS SQL
Include Arel::Predicates to Arel::Nodes::Function so you can do table[:id].count.eq(2)
updating spec
zomg prep release
make sure thread runs
do not cache sql literal values
no longer use this instance variable
Diffstat (limited to 'lib/arel/nodes')
-rw-r--r-- | lib/arel/nodes/ascending.rb | 23 | ||||
-rw-r--r-- | lib/arel/nodes/descending.rb | 23 | ||||
-rw-r--r-- | lib/arel/nodes/function.rb | 1 | ||||
-rw-r--r-- | lib/arel/nodes/named_function.rb | 2 | ||||
-rw-r--r-- | lib/arel/nodes/ordering.rb | 16 | ||||
-rw-r--r-- | lib/arel/nodes/unary.rb | 1 |
6 files changed, 49 insertions, 17 deletions
diff --git a/lib/arel/nodes/ascending.rb b/lib/arel/nodes/ascending.rb new file mode 100644 index 0000000000..bca00a8339 --- /dev/null +++ b/lib/arel/nodes/ascending.rb @@ -0,0 +1,23 @@ +module Arel + module Nodes + class Ascending < Ordering + + def reverse + Descending.new(expr) + end + + def direction + :asc + end + + def ascending? + true + end + + def descending? + false + end + + end + end +end diff --git a/lib/arel/nodes/descending.rb b/lib/arel/nodes/descending.rb new file mode 100644 index 0000000000..d886bdcb5f --- /dev/null +++ b/lib/arel/nodes/descending.rb @@ -0,0 +1,23 @@ +module Arel + module Nodes + class Descending < Ordering + + def reverse + Ascending.new(expr) + end + + def direction + :desc + end + + def ascending? + false + end + + def descending? + true + end + + end + end +end diff --git a/lib/arel/nodes/function.rb b/lib/arel/nodes/function.rb index 85347fc028..b6f6644678 100644 --- a/lib/arel/nodes/function.rb +++ b/lib/arel/nodes/function.rb @@ -2,6 +2,7 @@ module Arel module Nodes class Function < Arel::Nodes::Node include Arel::Expression + include Arel::Predications attr_accessor :expressions, :alias, :distinct def initialize expr, aliaz = nil diff --git a/lib/arel/nodes/named_function.rb b/lib/arel/nodes/named_function.rb index 5fca33e323..56669bf858 100644 --- a/lib/arel/nodes/named_function.rb +++ b/lib/arel/nodes/named_function.rb @@ -3,8 +3,6 @@ module Arel class NamedFunction < Arel::Nodes::Function attr_accessor :name - include Arel::Predications - def initialize name, expr, aliaz = nil super(expr, aliaz) @name = name diff --git a/lib/arel/nodes/ordering.rb b/lib/arel/nodes/ordering.rb index 0a3621cf54..efb4d18ae4 100644 --- a/lib/arel/nodes/ordering.rb +++ b/lib/arel/nodes/ordering.rb @@ -1,20 +1,6 @@ module Arel module Nodes - class Ordering < Arel::Nodes::Binary - alias :expr :left - alias :direction :right - - def initialize expr, direction = :asc - super - end - - def ascending? - direction == :asc - end - - def descending? - direction == :desc - end + class Ordering < Unary end end end diff --git a/lib/arel/nodes/unary.rb b/lib/arel/nodes/unary.rb index 5c4add4792..4688fff623 100644 --- a/lib/arel/nodes/unary.rb +++ b/lib/arel/nodes/unary.rb @@ -18,6 +18,7 @@ module Arel Not Offset On + Ordering Top Lock DistinctOn |