Method: Array#pick

Defined in:
lib/unbelievable/core_ext/array.rb

#pick(size) ⇒ Object



7
8
9
10
# File 'lib/unbelievable/core_ext/array.rb', line 7

def pick(size)
  word = self.select { |item| item.size == size }.sample
  word ||= "x" * size # Only if we miss the word in the dictionary.
end