lib/kamerling/uuid.rb in kamerling-0.0.2 vs lib/kamerling/uuid.rb in kamerling-0.0.3
- old
+ new
@@ -1,17 +1,19 @@
require 'securerandom'
-module Kamerling module UUID
- module_function
+module Kamerling
+ module UUID
+ module_function
- def [] bin
- bin.unpack('H8H4H4H4H12').join '-'
- end
+ def [](bin)
+ bin.unpack('H8H4H4H4H12').join('-')
+ end
- def bin uuid
- [uuid.tr('-', '')].pack 'H*'
- end
+ def bin(uuid)
+ [uuid.tr('-', '')].pack('H*')
+ end
- def new
- SecureRandom.uuid
+ def new
+ SecureRandom.uuid
+ end
end
-end end
+end