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.
'en_US'
- USER_DIR =
The directory name used to store user installed dictionaries.
'.hunspell_default'
- KNOWN_DIRECTORIES =
Known directories to search within for dictionaries.
[ # User Env.home.join(USER_DIR), # Debian '/usr/local/share/myspell/dicts', '/usr/share/myspell/dicts', # 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.
-
.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.
107 108 109 |
# File 'lib/ffi/hunspell/hunspell.rb', line 107 def Hunspell.dict(name=Hunspell.lang,&block) Dictionary.open(name,&block) end |
.directories ⇒ Array<String, Pathname>
The dictionary directories to search for dictionary files.
87 88 89 90 91 |
# File 'lib/ffi/hunspell/hunspell.rb', line 87 def Hunspell.directories @directories ||= KNOWN_DIRECTORIES.select do |path| File.directory?(path) end end |
.lang ⇒ String
The default language.
42 43 44 |
# File 'lib/ffi/hunspell/hunspell.rb', line 42 def Hunspell.lang @lang ||= (Env.lang[0] || DEFAULT_LANG) end |
.lang=(new_lang) ⇒ String
Sets the default language.
57 58 59 |
# File 'lib/ffi/hunspell/hunspell.rb', line 57 def Hunspell.lang=(new_lang) @lang = new_lang.to_s end |