aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/predications.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/predications.rb')
-rw-r--r--lib/arel/predications.rb24
1 files changed, 5 insertions, 19 deletions
diff --git a/lib/arel/predications.rb b/lib/arel/predications.rb
index 44059a54fe..36eae074a8 100644
--- a/lib/arel/predications.rb
+++ b/lib/arel/predications.rb
@@ -1,5 +1,6 @@
module Arel
module Predications
+
def as other
Nodes::As.new self, Nodes::SqlLiteral.new(other)
end
@@ -162,32 +163,17 @@ module Arel
grouping_all :lteq, others
end
- def asc
- Nodes::Ordering.new self, :asc
- end
-
- def desc
- Nodes::Ordering.new self, :desc
- end
-
private
def grouping_any method_id, others
- others = others.dup
- first = send method_id, others.shift
-
- Nodes::Grouping.new others.inject(first) { |memo,expr|
- Nodes::Or.new(memo, send(method_id, expr))
+ nodes = others.map {|expr| send(method_id, expr)}
+ Nodes::Grouping.new nodes.inject { |memo,node|
+ Nodes::Or.new(memo, node)
}
end
def grouping_all method_id, others
- others = others.dup
- first = send method_id, others.shift
-
- Nodes::Grouping.new others.inject(first) { |memo,expr|
- Nodes::And.new([memo, send(method_id, expr)])
- }
+ Nodes::Grouping.new Nodes::And.new(others.map {|expr| send(method_id, expr)})
end
end
end