Class: Jupiter::UUID
- Inherits:
-
Object
- Object
- Jupiter::UUID
- Defined in:
- lib/jupiter/uuid.rb
Instance Method Summary collapse
Instance Method Details
#generate(text) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/jupiter/uuid.rb', line 10 def generate(text) v = Digest::MD5.hexdigest(pad(text)) v.gsub!(/(.{2})(?=.)/, '\1 \2') v.insert 23, "-" v.slice!(24) return v end |
#pad(text) ⇒ Object
5 6 7 8 |
# File 'lib/jupiter/uuid.rb', line 5 def pad(text) v = text * (1 + (64 / text.length)) v[0,64] end |