Skip to content

Commit

Permalink
deprecate rather than remove
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis committed Nov 8, 2023
1 parent 5683241 commit 369e6ec
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/mongoid/criteria/queryable/extensions/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ def __expand_complex__
self
end

# Is the object a regex.
#
# @example Is the object a regex?
# obj.regexp?
#
# @return [ false ] Always false.
# @deprecated
def regexp?
false
end
Mongoid.deprecate(self, :regexp?)

module ClassMethods

# Evolve the object.
Expand Down
20 changes: 20 additions & 0 deletions lib/mongoid/criteria/queryable/extensions/regexp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ module Extensions
# Adds query type-casting behavior to Regexp class.
module Regexp

# Is the object a regexp?
#
# @example Is the object a regex?
# /\A[123]/.regexp?
#
# @return [ true ] Always true.
# @deprecated
def regexp?; true; end
Mongoid.deprecate(self, :regexp?)

module ClassMethods

# Evolve the object into a regex.
Expand All @@ -29,6 +39,16 @@ def evolve(object)
# Adds query type-casting behavior to BSON::Regexp::Raw class.
module Raw_

# Is the object a regexp?
#
# @example Is the object a regex?
# bson_raw_regexp.regexp?
#
# @return [ true ] Always true.
# @deprecated
def regexp?; true; end
Mongoid.deprecate(self, :regexp?)

module ClassMethods

# Evolve the object into a raw bson regex.
Expand Down

0 comments on commit 369e6ec

Please sign in to comment.