Skip to content

Commit 976fb36

Browse files
committed
Merge pull request #107 from durran/master
Revert ObjectId#to_ary
2 parents b8463a0 + 9360d0e commit 976fb36

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

lib/bson/types/object_id.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ def to_a
116116
@data.dup
117117
end
118118

119-
# Returns the object id as a single element in an array for use with Kernel#Array
120-
#
121-
# @return [Array]
122-
def to_ary
123-
[ self ]
124-
end
125-
126119
# Given a string representation of an ObjectId, return a new ObjectId
127120
# with that value.
128121
#

test/bson/object_id_test.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ def test_as_json
136136
assert_equal({"$oid" => id.to_s}, id.as_json)
137137
end
138138

139-
def test_to_ary
139+
def test_object_id_array_flatten
140140
id = ObjectId.new
141-
assert_equal [id], id.to_ary
142-
assert_equal Array(id), id.to_ary
141+
assert_equal [ id ], [[ id ]].flatten
142+
end
143+
144+
def test_object_id_array_flatten_bang
145+
id = ObjectId.new
146+
assert_equal [ id ], [[ id ]].flatten!
143147
end
144148
end

0 commit comments

Comments
 (0)