diff options
author | Tamir Duberstein <tamird@squareup.com> | 2014-09-24 19:01:33 -0700 |
---|---|---|
committer | Tamir Duberstein <tamird@squareup.com> | 2014-09-25 13:30:03 -0700 |
commit | fef9ce493ec3eab3cf120550abd0257f89eaddf7 (patch) | |
tree | 6f607b2c312db046a488629f39bd8755b4cbc5c9 /lib/arel/predications.rb | |
parent | b57a11cb8abfca345f63084ce841c6f412c1156e (diff) | |
download | rails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.tar.gz rails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.tar.bz2 rails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.zip |
{Matches,DoesNotMatch} support the ESCAPE clause
Diffstat (limited to 'lib/arel/predications.rb')
-rw-r--r-- | lib/arel/predications.rb | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/arel/predications.rb b/lib/arel/predications.rb index 1941383068..3050526a43 100644 --- a/lib/arel/predications.rb +++ b/lib/arel/predications.rb @@ -100,28 +100,28 @@ module Arel grouping_all :not_in, others end - def matches other - Nodes::Matches.new self, Nodes.build_quoted(other, self) + def matches other, escape = nil + Nodes::Matches.new self, Nodes.build_quoted(other, self), escape end - def matches_any others - grouping_any :matches, others + def matches_any others, escape = nil + grouping_any :matches, others, escape end - def matches_all others - grouping_all :matches, others + def matches_all others, escape = nil + grouping_all :matches, others, escape end - def does_not_match other - Nodes::DoesNotMatch.new self, Nodes.build_quoted(other, self) + def does_not_match other, escape = nil + Nodes::DoesNotMatch.new self, Nodes.build_quoted(other, self), escape end - def does_not_match_any others - grouping_any :does_not_match, others + def does_not_match_any others, escape = nil + grouping_any :does_not_match, others, escape end - def does_not_match_all others - grouping_all :does_not_match, others + def does_not_match_all others, escape = nil + grouping_all :does_not_match, others, escape end def gteq right @@ -174,15 +174,16 @@ module Arel private - def grouping_any method_id, others - nodes = others.map {|expr| send(method_id, expr)} + def grouping_any method_id, others, *extras + nodes = others.map {|expr| send(method_id, expr, *extras)} Nodes::Grouping.new nodes.inject { |memo,node| Nodes::Or.new(memo, node) } end - def grouping_all method_id, others - Nodes::Grouping.new Nodes::And.new(others.map {|expr| send(method_id, expr)}) + def grouping_all method_id, others, *extras + nodes = others.map {|expr| send(method_id, expr, *extras)} + Nodes::Grouping.new Nodes::And.new(nodes) end end end |