Skip to content

Commit d5d217d

Browse files
committed
MONGOID-5222 remove mongoize_safe
1 parent b1867b3 commit d5d217d

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

lib/mongoid/extensions/object.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,6 @@ def mongoize
127127
self
128128
end
129129

130-
# Mongoize the given value and return nil if an error is raised.
131-
#
132-
# @return [ Object ] The object.
133-
#
134-
# @api private
135-
def mongoize_safe
136-
mongoize rescue nil
137-
end
138-
139130
# Is the object multi args.
140131
#
141132
# @example Is the object multi args?
@@ -249,17 +240,6 @@ def mongoize(object)
249240
object.mongoize
250241
end
251242

252-
# Mongoize the given value and return nil if an error is raised.
253-
#
254-
# @param [ Object ] object The object to mongoize.
255-
#
256-
# @return [ Object ] The object mongoized.
257-
#
258-
# @api private
259-
def mongoize_safe(object)
260-
mongoize(object) rescue nil
261-
end
262-
263243
def _mongoid_wrap_mongoize(object)
264244
return if object.nil?
265245
yield.tap do |res|

spec/mongoid/mongoizable_spec.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
end.to raise_error(Mongoid::Errors::InvalidValue)
1717
end
1818
end
19-
20-
context "to mongoize_safe" do
21-
it "return nil" do
22-
expect(klass.mongoize_safe(invalid_value)).to be_nil
23-
end
24-
end
2519
end
2620

2721
context "when assigning an invalid value to a field" do
@@ -60,12 +54,6 @@
6054
expect(klass.mongoize(invalid_value)).to eq(mongoized_value)
6155
end
6256
end
63-
64-
context "to mongoize_safe" do
65-
it "returns that value" do
66-
expect(klass.mongoize_safe(invalid_value)).to eq(mongoized_value)
67-
end
68-
end
6957
end
7058

7159
context "when assigning an invalid value to a field" do

0 commit comments

Comments
 (0)