Fixed ObjectID.from_string bug.
This commit is contained in:
parent
80dd421dd9
commit
3dd465ddec
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user