RubyでのUUIDのversion 1の使い方。

gem install uuid
>> require 'rubygems'
=> true
>> require 'uuid'
=> true
>> UUID.new
=> MAC: 58:55:ca:f3:26:47  Sequence: 9499
>> UUID.new.generate
=> "bc66c930-22f1-012e-251b-5855caf32647"
>> UUID.new.generate :compact
=> "be64e03022f1012e251b5855caf32647"

:compactはハイフンを取ってくれる。


How to use UUID Version 1 in Ruby.

:compact option omits the hyphens.

Comments


Option