Use C objectid_generate for ObjectId in addition to ObjectID.

Also, remove broken defined? check from objectid.rb and object_id.rb -
it was never doing anything since we require those files at the top of
cbson.c.
This commit is contained in:
Mike Dirolf 2010-08-25 10:23:18 -04:00
parent 9eee412213
commit 7702d671ea
3 changed files with 27 additions and 30 deletions

View File

@ -949,6 +949,7 @@ void Init_cbson() {
DigestMD5 = rb_const_get(Digest, rb_intern("MD5"));
rb_define_method(ObjectID, "generate", objectid_generate, 0);
rb_define_method(ObjectId, "generate", objectid_generate, 0);
rb_define_method(rb_cArray, "fast_pack", fast_pack, 0);
}

View File

@ -155,8 +155,7 @@ module BSON
private
# We need to define this method only if CBson isn't loaded.
unless defined? CBson
# This gets overwritten by the C extension if it loads.
def generate
oid = ''
@ -175,7 +174,6 @@ module BSON
oid.unpack("C12")
end
end
def get_inc
@@lock.synchronize do

View File

@ -158,8 +158,7 @@ module BSON
private
# We need to define this method only if CBson isn't loaded.
unless defined? CBson
# This gets overwritten by the C extension if it loads.
def generate
oid = ''
@ -178,7 +177,6 @@ module BSON
oid.unpack("C12")
end
end
def get_inc
@@lock.synchronize do