Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit a1cdabd43b2ce654268f4d80af63571bd9838bb4 1 parent 8f372e8
@mislav authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.