Class: WordSalad
- Inherits:
-
Object
- Object
- WordSalad
- Defined in:
- lib/word_salad.rb
Class Method Summary collapse
-
.dictionary ⇒ Object
:nodoc:.
-
.dictionary_path ⇒ Object
The current dictionary path.
-
.dictionary_path=(path) ⇒ Object
Override the default dictionary path to something special.
-
.size ⇒ Object
:nodoc:.
Class Method Details
.dictionary ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/word_salad.rb', line 19 def self.dictionary # :nodoc: open(self.dictionary_path) end |
.dictionary_path ⇒ Object
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 |
.size ⇒ Object
:nodoc:
23 24 25 |
# File 'lib/word_salad.rb', line 23 def self.size # :nodoc: @size ||= File.size(self.dictionary) end |