Skip to content

Commit c7d63d6

Browse files
committed
Remove String#mongoid_id? and Symbol#mongoid_id?
1 parent 30f46d4 commit c7d63d6

File tree

4 files changed

+0
-82
lines changed

4 files changed

+0
-82
lines changed

lib/mongoid/extensions/string.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,6 @@ def collectionize
6363
tableize.gsub("/", "_")
6464
end
6565

66-
# Is the string a valid value for a Mongoid id?
67-
#
68-
# @example Is the string an id value?
69-
# "_id".mongoid_id?
70-
#
71-
# @return [ true | false ] If the string is id or _id.
72-
def mongoid_id?
73-
self =~ /\A(|_)id\z/
74-
end
75-
7666
# Is the string a number? The literals "NaN", "Infinity", and "-Infinity"
7767
# are counted as numbers.
7868
#

lib/mongoid/extensions/symbol.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@ module Extensions
77
# Adds type-casting behavior to Symbol class.
88
module Symbol
99

10-
# Is the symbol a valid value for a Mongoid id?
11-
#
12-
# @example Is the string an id value?
13-
# :_id.mongoid_id?
14-
#
15-
# @return [ true | false ] If the symbol is :id or :_id.
16-
def mongoid_id?
17-
to_s.mongoid_id?
18-
end
19-
2010
module ClassMethods
2111

2212
# Turn the object from the ruby type we deal with to a Mongo friendly

spec/mongoid/extensions/string_spec.rb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -172,37 +172,6 @@ class Patient
172172
end
173173
end
174174

175-
describe "#mongoid_id?" do
176-
177-
context "when the string is id" do
178-
179-
it "returns true" do
180-
expect("id").to be_mongoid_id
181-
end
182-
end
183-
184-
context "when the string is _id" do
185-
186-
it "returns true" do
187-
expect("_id").to be_mongoid_id
188-
end
189-
end
190-
191-
context "when the string contains id" do
192-
193-
it "returns false" do
194-
expect("identity").to_not be_mongoid_id
195-
end
196-
end
197-
198-
context "when the string contains _id" do
199-
200-
it "returns false" do
201-
expect("something_id").to_not be_mongoid_id
202-
end
203-
end
204-
end
205-
206175
[ :mongoize, :demongoize ].each do |method|
207176

208177
describe ".#{method}" do

spec/mongoid/extensions/symbol_spec.rb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,6 @@
55

66
describe Mongoid::Extensions::Symbol do
77

8-
describe "#mongoid_id?" do
9-
10-
context "when the string is id" do
11-
12-
it "returns true" do
13-
expect(:id).to be_mongoid_id
14-
end
15-
end
16-
17-
context "when the string is _id" do
18-
19-
it "returns true" do
20-
expect(:_id).to be_mongoid_id
21-
end
22-
end
23-
24-
context "when the string contains id" do
25-
26-
it "returns false" do
27-
expect(:identity).to_not be_mongoid_id
28-
end
29-
end
30-
31-
context "when the string contains _id" do
32-
33-
it "returns false" do
34-
expect(:something_id).to_not be_mongoid_id
35-
end
36-
end
37-
end
38-
398
[ :mongoize, :demongoize ].each do |method|
409

4110
describe ".mongoize" do

0 commit comments

Comments
 (0)