module NiceUuid
Constants
- DEFAULT_NUMBER_OF_WORDS
- DICTIONARY_PATH
- VERSION
Public Class Methods
generate(maximum=36)
click to toggle source
# File lib/nice_uuid.rb, line 7 def self.generate(maximum=36) 10000.times do @solution = possible_nice_uuid break if @solution.length <= maximum end @solution end
Private Class Methods
array_of_all_words()
click to toggle source
# File lib/nice_uuid.rb, line 25 def self.array_of_all_words @array_of_all_words ||= File.readlines(DICTIONARY_PATH) end
bundle_of_words()
click to toggle source
# File lib/nice_uuid.rb, line 21 def self.bundle_of_words array_of_all_words.sample(DEFAULT_NUMBER_OF_WORDS) end
possible_nice_uuid()
click to toggle source
# File lib/nice_uuid.rb, line 17 def self.possible_nice_uuid bundle_of_words.map(&:strip).shuffle.join('-') end