Fixed ObjectID.from_string bug.

This commit is contained in:
Jim Menard 2009-01-12 09:58:13 -05:00
parent 80dd421dd9
commit 3dd465ddec

View File

@ -57,10 +57,12 @@ module XGen
# with that value. # with that value.
def self.from_string(str) def self.from_string(str)
data = [] data = []
byte = 0
i = str.to_i(16) i = str.to_i(16)
while i > 0 while byte < 12
data << (i & 0xff) data << (i & 0xff)
i >>= 8 i >>= 8
byte += 1
end end
self.new(data.reverse) self.new(data.reverse)
end end