Class: WordGuesser::Dictionary

Inherits:
Object
  • Object
show all
Defined in:
lib/word_guesser/dictionary.rb

Constant Summary collapse

DICTIONARY_FILENAME =
File.join(File.dirname(__FILE__), "enable1.txt")

Class Method Summary collapse

Class Method Details

.wordsObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/word_guesser/dictionary.rb', line 5

def self.words
  unless @dictionary
    @dictionary = []
    File.open DICTIONARY_FILENAME do |file|
      file.each do |line|
        @dictionary << line.strip
      end
    end
  end
  @dictionary
end