Class: WordSalad

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

Class Method Summary collapse

Class Method Details

.dictionaryObject

:nodoc:



19
20
21
# File 'lib/word_salad.rb', line 19

def self.dictionary # :nodoc:
  open(self.dictionary_path)
end

.dictionary_pathObject

The current dictionary path



6
7
8
9
10
11
# File 'lib/word_salad.rb', line 6

def self.dictionary_path
  @dictionary_path ||= ["/usr/share/dict/words",
                      "/usr/share/words"].select do |f|
    FileTest.exists?(f)
  end.first
end

.dictionary_path=(path) ⇒ Object

Override the default dictionary path to something special



14
15
16
17
# File 'lib/word_salad.rb', line 14

def self.dictionary_path=(path)
  @dictionary_path = path
  @size = nil
end

.sizeObject

:nodoc:



23
24
25
# File 'lib/word_salad.rb', line 23

def self.size  # :nodoc:
  @size ||= File.size(self.dictionary)
end