Skip to content
Browse files

Revert "ability to create ObjectId at a given time"

This functionality is implemented in bson v1.3

This reverts commits:
 - d308d45
 - b3efd55.
  • Loading branch information...
1 parent 8f372e8 commit a1cdabd43b2ce654268f4d80af63571bd9838bb4 @mislav committed Apr 26, 2011
Showing with 0 additions and 23 deletions.
  1. +0 −23 lib/mingo.rb
View
23 lib/mingo.rb
@@ -2,10 +2,6 @@
require 'mongo'
require 'active_model'
require 'hashie/dash'
-# for ObjectId:
-require 'thread'
-require 'socket'
-require 'digest/md5'
BSON::ObjectId.class_eval do
def self.[](id)
@@ -15,25 +11,6 @@ def self.[](id)
def id
self
end
-
- def initialize(time_or_data = nil)
- if Time === time_or_data or Date === time_or_data
- @data = generate_from_time(time_or_data)
- else
- @data = time_or_data || generate
- end
- end
-
- private
-
- def generate_from_time(time)
- oid = ''
- oid += [time.to_i].pack("N")
- oid += Digest::MD5.digest(Socket.gethostname)[0, 3]
- oid += [Process.pid % 0xFFFF].pack("n")
- oid += [get_inc].pack("N")[1, 3]
- oid.unpack("C12")
- end
end
class Mingo < Hashie::Dash

0 comments on commit a1cdabd

Please sign in to comment.
Something went wrong with that request. Please try again.