Module: PseudoGuidGenerator
- Defined in:
- lib/adhearsion/foundation/pseudo_guid.rb
Instance Method Summary collapse
-
#new_guid(separator = "-") ⇒ Object
Generates a new 128-bit Globally Unique Identifier.
Instance Method Details
#new_guid(separator = "-") ⇒ Object
Generates a new 128-bit Globally Unique Identifier. It is a “pseudo” in that it does not adhere to the RFC which mandates that a certain section be reserved for a fragment of the NIC MAC address.
5 6 7 |
# File 'lib/adhearsion/foundation/pseudo_guid.rb', line 5 def new_guid(separator="-") [8,4,4,4,12].map { |segment_length| String.random(segment_length) }.join(separator) end |