Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
26 changed files
with
299 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ def initialize expr | |
Not | ||
Offset | ||
On | ||
Ordering | ||
Top | ||
Lock | ||
DistinctOn | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'helper' | ||
|
||
module Arel | ||
module Nodes | ||
class TestAscending < MiniTest::Unit::TestCase | ||
def test_construct | ||
ascending = Ascending.new 'zomg' | ||
assert_equal 'zomg', ascending.expr | ||
end | ||
|
||
def test_reverse | ||
ascending = Ascending.new 'zomg' | ||
descending = ascending.reverse | ||
assert_kind_of Descending, descending | ||
assert_equal ascending.expr, descending.expr | ||
end | ||
|
||
def test_direction | ||
ascending = Ascending.new 'zomg' | ||
assert_equal :asc, ascending.direction | ||
end | ||
|
||
def test_ascending? | ||
ascending = Ascending.new 'zomg' | ||
assert ascending.ascending? | ||
end | ||
|
||
def test_descending? | ||
ascending = Ascending.new 'zomg' | ||
assert !ascending.descending? | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.