Class: CipherBureau::Dictionary

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/cipher_bureau/dictionary.rb

Class Method Summary collapse

Class Method Details

.random(*args) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/cipher_bureau/dictionary.rb', line 40

def random(*args)
  criteria = args.extract_options!
  camelize = criteria.delete(:camelize)
  criteria.merge!(:length => args.first) if args.first
  r = fetch_random_word(criteria)
  r && (camelize ? capitalize(r.word) : r.word)
end