From 508a6783c8f75742ac64e5073b3b211b0c15662a Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Sat, 5 Dec 2015 18:54:09 -0500 Subject: Add case sensitive match Explicitly declare if this is case sensitive or not most implementation assume case sensitive postgres assumes case insensitive --- lib/arel/predications.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/arel/predications.rb') diff --git a/lib/arel/predications.rb b/lib/arel/predications.rb index b05fc6f99a..ed083f5402 100644 --- a/lib/arel/predications.rb +++ b/lib/arel/predications.rb @@ -118,20 +118,20 @@ Passing a range to `#not_in` is deprecated. Call `#not_between`, instead. grouping_all :not_in, others end - def matches other, escape = nil - Nodes::Matches.new self, quoted_node(other), escape + def matches other, escape = nil, case_sensitive = false + Nodes::Matches.new self, quoted_node(other), escape, case_sensitive end - def matches_any others, escape = nil - grouping_any :matches, others, escape + def matches_any others, escape = nil, case_sensitive = false + grouping_any :matches, others, escape, case_sensitive end - def matches_all others, escape = nil - grouping_all :matches, others, escape + def matches_all others, escape = nil, case_sensitive = false + grouping_all :matches, others, escape, case_sensitive end - def does_not_match other, escape = nil - Nodes::DoesNotMatch.new self, quoted_node(other), escape + def does_not_match other, escape = nil, case_sensitive = false + Nodes::DoesNotMatch.new self, quoted_node(other), escape, case_sensitive end def does_not_match_any others, escape = nil -- cgit v1.2.3 From d2e6be1677b124b3eef5b3ebe0fd4a0d31d8a2bf Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Sat, 5 Dec 2015 20:23:12 -0500 Subject: introduce predicate {does_not_}matches_regexp --- lib/arel/predications.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/arel/predications.rb') diff --git a/lib/arel/predications.rb b/lib/arel/predications.rb index ed083f5402..1d2b0de235 100644 --- a/lib/arel/predications.rb +++ b/lib/arel/predications.rb @@ -122,6 +122,10 @@ Passing a range to `#not_in` is deprecated. Call `#not_between`, instead. Nodes::Matches.new self, quoted_node(other), escape, case_sensitive end + def matches_regexp other, case_sensitive = true + Nodes::Regexp.new self, quoted_node(other), case_sensitive + end + def matches_any others, escape = nil, case_sensitive = false grouping_any :matches, others, escape, case_sensitive end @@ -134,6 +138,10 @@ Passing a range to `#not_in` is deprecated. Call `#not_between`, instead. Nodes::DoesNotMatch.new self, quoted_node(other), escape, case_sensitive end + def does_not_match_regexp other, case_sensitive = true + Nodes::NotRegexp.new self, quoted_node(other), case_sensitive + end + def does_not_match_any others, escape = nil grouping_any :does_not_match, others, escape end -- cgit v1.2.3