Module: WordSalad
- Defined in:
- lib/word_salad.rb
Overview
This module generates random English words
Class Method Summary collapse
-
.dictionary ⇒ Object
the dictionary as a File object.
- .dictionary_path=(filename) ⇒ Object
-
.size ⇒ Object
the number of words in the dictionary.
-
.words ⇒ Object
all the words in the dictionary.
Class Method Details
.dictionary ⇒ Object
the dictionary as a File object
7 8 9 10 |
# File 'lib/word_salad.rb', line 7 def dictionary @dictionary ||= File.open(File.join(File.dirname(__FILE__), 'word_salad/dictionary')) end |
.dictionary_path=(filename) ⇒ Object
12 13 14 |
# File 'lib/word_salad.rb', line 12 def dictionary_path=(filename) @dictionary = filename end |
.size ⇒ Object
the number of words in the dictionary
20 21 22 |
# File 'lib/word_salad.rb', line 20 def size @size ||= words.size end |
.words ⇒ Object
all the words in the dictionary
17 |
# File 'lib/word_salad.rb', line 17 def words = File.readlines(dictionary, chomp: true) |