em-mongo 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ module EM::Mongo
26
26
  end
27
27
 
28
28
  def insert(obj)
29
- obj['_id'] ||= EM::Mongo::Util.unique_id
29
+ obj['_id'] ||= BSON::ObjectID.new
30
30
  @connection.insert(@name, obj)
31
31
  obj
32
32
  end
data/lib/em-mongo.rb CHANGED
@@ -14,12 +14,6 @@ module EM::Mongo
14
14
  NAME = 'em-mongo'
15
15
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
16
16
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
17
-
18
- class Util
19
- def self.unique_id
20
- BSON::ObjectID.new.to_s
21
- end
22
- end
23
17
  end
24
18
 
25
19
  require File.join(EM::Mongo::LIBPATH, "em-mongo/connection")
@@ -24,8 +24,7 @@ describe EMMongo::Collection do
24
24
  EM::Spec::Mongo.collection do |collection|
25
25
  obj = collection.insert('hello' => 'world')
26
26
  obj.keys.should include '_id'
27
- obj['_id'].should be_a_kind_of String
28
- obj['_id'].length.should == 24
27
+ obj['_id'].should be_a_kind_of(BSON::ObjectID)
29
28
  EM::Spec::Mongo.close
30
29
  end
31
30
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 11
9
- version: 0.2.11
8
+ - 12
9
+ version: 0.2.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - bcg