Module: Identifier::UUID::Controls::Incrementing
- Defined in:
- lib/identifier/uuid/controls/incrementing.rb
Class Method Summary collapse
Class Method Details
.example(i = nil, increment: nil, sample: nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/identifier/uuid/controls/incrementing.rb', line 5 def self.example(i=nil, increment: nil, sample: nil) i ||= increment || 1 sample ||= false first_octet = (i).to_s.rjust(8, '0') fourth_prefixes = ['8', '9', 'a', 'b'] if sample fourth_prefix = fourth_prefixes.sample else fourth_prefix = fourth_prefixes[0] end "#{first_octet}-0000-4000-#{fourth_prefix}000-000000000000" end |