Module: Madgab
- Defined in:
- lib/madgab.rb,
lib/madgab/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
-
.diction ⇒ Object
Sets the dictionaries.
-
.generate ⇒ Object
Generates a more random string of words like in the game Mad Gab.
Class Method Details
.diction ⇒ Object
Sets the dictionaries
14 15 16 17 18 19 20 21 |
# File 'lib/madgab.rb', line 14 def diction @@diction = Hash.new openpath = File.dirname(__FILE__) + '/madgab/dictionaries/' @@diction[:adj] = IO.readlines(openpath + 'adj.csv').map {|v| v.strip } @@diction[:adv] = IO.readlines(openpath + 'adv.csv').map {|v| v.strip } @@diction[:noun] = IO.readlines(openpath + 'noun.csv').map {|v| v.strip } @@diction[:verb] = IO.readlines(openpath + 'verb.csv').map {|v| v.strip } end |
.generate ⇒ Object
Generates a more random string of words like in the game Mad Gab
5 6 7 8 9 10 11 |
# File 'lib/madgab.rb', line 5 def generate unless defined? @@diction self.diction end words = ["the", adv, adj, noun, verb].join('_') end |