lib/ffi/hunspell/hunspell.rb in ffi-hunspell-0.2.5 vs lib/ffi/hunspell/hunspell.rb in ffi-hunspell-0.2.6
- old
+ new
@@ -1,7 +1,6 @@
require 'ffi'
-require 'env'
module FFI
module Hunspell
extend FFI::Library
@@ -28,28 +27,28 @@
# attach_function :Hunspell_stem2, [:pointer, :pointer, :pointer, :int], :int
# attach_function :Hunspell_generate2, [:pointer, :pointer, :string, :pointer, :int], :int
#
# The language to default to, if no 'LANG' env variable was set.
- DEFAULT_LANG = 'en_US'
+ DEFAULT_LANG = ENV.fetch('LANG','en_US.UTF-8').split('.',2).first
#
# The default language.
#
# @return [String]
# The name of the default language.
#
# @since 0.2.0
#
def Hunspell.lang
- @lang ||= (Env.lang[0] || DEFAULT_LANG)
+ @lang ||= DEFAULT_LANG
end
#
# Sets the default language.
#
- # @param [String] name
+ # @param [String] new_lang
# The new language name.
#
# @return [String]
# The name of the new default language.
#
@@ -63,10 +62,10 @@
USER_DIR = '.hunspell_default'
# Known directories to search within for dictionaries.
KNOWN_DIRECTORIES = [
# User
- Env.home.join(USER_DIR),
+ File.join(Gem.user_home,USER_DIR),
# Debian
'/usr/local/share/myspell/dicts',
'/usr/share/myspell/dicts',
# Fedora
'/usr/local/share/myspell',