Module: FFI::Hunspell
- Extended by:
- Library
- Defined in:
- lib/ffi/hunspell/version.rb,
lib/ffi/hunspell/hunspell.rb,
lib/ffi/hunspell/dictionary.rb
Defined Under Namespace
Classes: Dictionary
Constant Summary collapse
- VERSION =
ffi-hunspell versiont
'0.6.1'
- 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.
136 137 138 |
# File 'lib/ffi/hunspell/hunspell.rb', line 136 def self.dict(name=Hunspell.lang,&block) Dictionary.open(name,&block) end |
.directories ⇒ Array<String, Pathname>
The dictionary directories to search for dictionary files.
112 113 114 115 116 |
# File 'lib/ffi/hunspell/hunspell.rb', line 112 def self.directories @directories ||= KNOWN_DIRECTORIES.select do |path| File.directory?(path) end end |
.directories=(dirs) ⇒ Object
118 119 120 |
# File 'lib/ffi/hunspell/hunspell.rb', line 118 def self.directories=(dirs) @directories = dirs end |
.lang ⇒ String
The default language.
62 63 64 |
# File 'lib/ffi/hunspell/hunspell.rb', line 62 def self.lang @lang ||= DEFAULT_LANG end |
.lang=(new_lang) ⇒ String
Sets the default language.
77 78 79 |
# File 'lib/ffi/hunspell/hunspell.rb', line 77 def self.lang=(new_lang) @lang = new_lang.to_s end |