You can configure Cryptozoologist to do the following:
- include extra dictionaries
- exclude subsets of dictionaries
- change the order of words in the
random
method - change the delimiter for the
random
method
You should configure your settings once. If you call configure
more than once, it will remove any previous settings and use the new ones instead.
Configuration blocks look like this:
Cryptozoologist.configure do |config|
config.exclude = []
config.include = []
config.order = []
config.delimiter = ''
end
exclude
(array of symbols) allows you to exclude dictionary subtypes; defaults to no exclusionsinclude
(array of symbols) allows you to include optional dictionaries; defaults to no inclusionsorder
(array of symbols) allows you to change the word order; defaults toanimal-color-clothing
delimiter
(string) allows you to specify a delimiter; defaults to-
Options: array of symbols
:quantity
: adds words from theQuantity
dictionary to the end of your string when calling therandom
method
Example:
Cryptozoologist.configure do |config|
config.include = [:quantity]
end
Options: array of symbols
- animals (1 of 2 allowed):
:common
,:mythical
- colors (1 of 2 allowed):
:paint
,:web
Note: you can only use 2 exclusions in your config, once from each dictionary.
Valid:
Cryptozoologist.configure do |config|
config.exclude = [:common, :paint]
end
Invalid:
# no animal dictionaries
Cryptozoologist.configure do |config|
config.exclude = [:common, :mythical]
end
# no color dictionaries
Cryptozoologist.configure do |config|
config.exclude = [:paint, :web]
end
# what are you doing?!
Cryptozoologist.configure do |config|
config.exclude = [:common, :paint, :web]
end
Options: array of symbols, must provide 3 keys
[:animals, :colors, :clothing]
Cryptozoologist.configure do |config|
config.order = [:colors, :clothing, :animals]
end
Options: string, any length (defaults to -
)
Note: this only changes the output for the random
method.
Cryptozoologist.configure do |config|
config.delimiter = "_"
end
Cryptozoologist.configure do |config|
config.exclude = [:common, :paint]
config.include = [:quantity]
config.order = [:colors, :animals, :clothing]
config.delimiter = '_'
end
Cryptozoologist.random # => 'masses_yellow_zombie_shrug'
Cryptozoologist.random # => 'gazillions_purple_goblin_umbrella'
Cryptozoologist.random # => 'wide_orange_cynocephalus_helmet'
Cryptozoologist.random # => 'some_light_pink_moke_fedora'