Spicy::Proton
Generate a random English adjective-noun word pair. Works with Ruby 1.9.x and newer.
Quick Start
gem install spicy-proton
require 'spicy-proton'
puts Spicy::Proton.pair
# => "decadent-inquisition"
Usage
When generating single or infrequent specimens, class methods are faster and use less memory.
require 'spicy-proton'
Spicy::Proton.adjective # => "extreme"
Spicy::Proton.noun # => "loan"
Spicy::Proton.pair # => "opportune-spacesuit"
Spicy::Proton.pair(':') # => "hip:squash"
Spicy::Proton.format('%a/%a/%n') # => "dapper/festive/fedora"
# With length constraints.
Spicy::Proton.adjective(max: 5) # => "dank"
Spicy::Proton.noun(min: 10) # => "interpolation"
Spicy::Proton.adjective(length: 8) # => "medieval"
Spicy::Proton.noun(min: 5, max: 7) # => "dolphin"
When generating multiple specimens, instance methods are faster. The instance keeps the word corpus in memory. The instance methods are the same as their class method counterparts.
require 'spicy-proton'
generator = Spicy::Proton.new
1000.times do
generator.adjective
generator.noun(min: 7)
generator.pair
generator.pair('.')
generator.format('%a-%n')
end
Instances give you access to the raw word lists as well:
generator.adjectives # => ["dreadful", "methodist", "necessary", "tough", ...]
generator.nouns # => ["rustling", "fiance", "infield", "chatter", ...]
License
Copyright © 2017 Chris Schmich
MIT License. See LICENSE for details.