Permalink
Browse files

Add ~/.dict/words to the default dictionary paths.

Fixes #11.
  • Loading branch information...
1 parent aaf1b7e commit 9e24aaab7d49f6f43d8e2ca95a3079bd99cce8d2 @benburkert committed Apr 11, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/randexp/dictionary.rb
@@ -1,14 +1,14 @@
class Randexp::Dictionary
def self.file_paths
- @dictionary_path ||= %w[/usr/share/dict/words /usr/dict/words]
+ @dictionary_path ||= %w[/usr/share/dict/words /usr/dict/words ~/.dict/words]
end
def self.register(path)
file_paths.unshift(path)
end
def self.load_dictionary
- if path = file_paths.detect {|path| File.exists?(path) }
+ if path = file_paths.detect {|path| File.exists?(File.expand_path(path)) }
File.read(path).split
else
raise "Words file not found. Check if it is installed in (/usr/share/dict/words or /usr/dict/words) "

0 comments on commit 9e24aaa

Please sign in to comment.