Module: FFI::Hunspell
- Extended by:
- Library
- Defined in:
- lib/ffi/hunspell/hunspell.rb,
lib/ffi/hunspell/dictionary.rb
Defined Under Namespace
Classes: Dictionary
Constant Summary collapse
- DEFAULT_LANG =
The language to default to, if no 'LANG' env variable was set.
ENV.fetch('LANG','en_US.UTF-8').split('.',2).first
- USER_DIR =
The directory name used to store user installed dictionaries.
'.hunspell_default'
- KNOWN_DIRECTORIES =
Known directories to search within for dictionaries.
[ # User File.join(Gem.user_home,USER_DIR), # OS X brew-instlled hunspell File.join(Gem.user_home,'Library/Spelling'), '/Library/Spelling', # Debian '/usr/local/share/myspell/dicts', '/usr/share/myspell/dicts', # Ubuntu '/usr/share/hunspell', # Fedora '/usr/local/share/myspell', '/usr/share/myspell', # Mac Ports '/opt/local/share/hunspell', '/opt/share/hunspell' ]
Class Method Summary collapse
-
.dict(name = Hunspell.lang) {|dict| ... } ⇒ nil
Opens a Hunspell dictionary.
-
.directories ⇒ Array<String, Pathname>
The dictionary directories to search for dictionary files.
- .directories=(dirs) ⇒ Object
-
.lang ⇒ String
The default language.
-
.lang=(new_lang) ⇒ String
Sets the default language.
Class Method Details
.dict(name = Hunspell.lang) {|dict| ... } ⇒ nil
Opens a Hunspell dictionary.
123 124 125 |
# File 'lib/ffi/hunspell/hunspell.rb', line 123 def self.dict(name=Hunspell.lang,&block) Dictionary.open(name,&block) end |
.directories ⇒ Array<String, Pathname>
The dictionary directories to search for dictionary files.
99 100 101 102 103 |
# File 'lib/ffi/hunspell/hunspell.rb', line 99 def self.directories @directories ||= KNOWN_DIRECTORIES.select do |path| File.directory?(path) end end |
.directories=(dirs) ⇒ Object
105 106 107 |
# File 'lib/ffi/hunspell/hunspell.rb', line 105 def self.directories=(dirs) @directories = dirs end |
.lang ⇒ String
The default language.
49 50 51 |
# File 'lib/ffi/hunspell/hunspell.rb', line 49 def self.lang @lang ||= DEFAULT_LANG end |
.lang=(new_lang) ⇒ String
Sets the default language.
64 65 66 |
# File 'lib/ffi/hunspell/hunspell.rb', line 64 def self.lang=(new_lang) @lang = new_lang.to_s end |