Skip to content

Commit

Permalink
MONGOID-5667 [Monkey Patch Removal] Remove String/Integer#unconvertab…
Browse files Browse the repository at this point in the history
…le_to_bson? (#5704)

* Remove String#unconvertable_to_bson? and Integer#unconvertable_to_bson?

* Remove one more usage

* MONGOID-5667 deprecate instead of remove

---------

Co-authored-by: Jamis Buck <[email protected]>
  • Loading branch information
johnnyshields and jamis authored Nov 7, 2023
1 parent f99e917 commit c304589
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/mongoid/extensions/integer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ def numeric?
# object.unconvertable_to_bson?
#
# @return [ true ] If the object is unconvertable.
# @deprecated
def unconvertable_to_bson?
true
end
Mongoid.deprecate(self, :unconvertable_to_bson?)

module ClassMethods

Expand Down
5 changes: 5 additions & 0 deletions lib/mongoid/extensions/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ module Extensions
module String

# @attribute [rw] unconvertable_to_bson If the document is unconvertable.
# @deprecated
attr_accessor :unconvertable_to_bson
Mongoid.deprecate(self, :unconvertable_to_bson, :unconvertable_to_bson=)

# Evolve the string into an object id if possible.
#
Expand Down Expand Up @@ -126,15 +128,18 @@ def before_type_cast?
ends_with?("_before_type_cast")
end


# Is the object not to be converted to bson on criteria creation?
#
# @example Is the object unconvertable?
# object.unconvertable_to_bson?
#
# @return [ true | false ] If the object is unconvertable.
# @deprecated
def unconvertable_to_bson?
@unconvertable_to_bson ||= false
end
Mongoid.deprecate(self, :unconvertable_to_bson?)

private

Expand Down

0 comments on commit c304589

Please sign in to comment.