module FFI::Hunspell

Constants

DEFAULT_LANG

The language to default to, if no 'LANG' env variable was set.

KNOWN_DIRECTORIES

Known directories to search within for dictionaries.

USER_DIR

The directory name used to store user installed dictionaries.

Public Class Methods

dict(name=Hunspell.lang,&block) click to toggle source

Opens a Hunspell dictionary.

@param [Symbol, String] name

The name of the dictionary to open.

@yield [dict]

The given block will be passed the Hunspell dictionary.

@yieldparam [Dictionary] dict

The opened dictionary.

@return [nil]

# File lib/ffi/hunspell/hunspell.rb, line 123
def self.dict(name=Hunspell.lang,&block)
  Dictionary.open(name,&block)
end
directories() click to toggle source

The dictionary directories to search for dictionary files.

@return [Array<String, Pathname>]

The directory paths.

@since 0.2.0

# File lib/ffi/hunspell/hunspell.rb, line 99
def self.directories
  @directories ||= KNOWN_DIRECTORIES.select do |path|
    File.directory?(path)
  end
end
directories=(dirs) click to toggle source
# File lib/ffi/hunspell/hunspell.rb, line 105
def self.directories=(dirs)
  @directories = dirs
end
lang() click to toggle source

The default language.

@return [String]

The name of the default language.

@since 0.2.0

# File lib/ffi/hunspell/hunspell.rb, line 49
def self.lang
  @lang ||= DEFAULT_LANG
end
lang=(new_lang) click to toggle source

Sets the default language.

@param [String] new_lang

The new language name.

@return [String]

The name of the new default language.

@since 0.2.0

# File lib/ffi/hunspell/hunspell.rb, line 64
def self.lang=(new_lang)
  @lang = new_lang.to_s
end