Module: SecureRandom
- Defined in:
- lib/puppet/util/monkey_patches.rb
Overview
Older versions of SecureRandom (e.g. in 1.8.7) don’t have the uuid method
Class Method Summary collapse
Class Method Details
.uuid ⇒ Object
218 219 220 221 222 223 224 |
# File 'lib/puppet/util/monkey_patches.rb', line 218 def self.uuid # Copied from the 1.9.1 stdlib implementation of uuid ary = self.random_bytes(16).unpack("NnnnnN") ary[2] = (ary[2] & 0x0fff) | 0x4000 ary[3] = (ary[3] & 0x3fff) | 0x8000 "%08x-%04x-%04x-%04x-%04x%08x" % ary end |