diff --git a/lib/locale/driver/win32.rb b/lib/locale/driver/win32.rb index a912984..ea38808 100644 --- a/lib/locale/driver/win32.rb +++ b/lib/locale/driver/win32.rb @@ -22,7 +22,21 @@ require "locale/driver/env" require "locale/driver/win32_table" -require "dl/import" +if RUBY_VERSION < "2.1" + require "dl/import" +else + require 'fiddle' + require 'fiddle/import' + + # For now map DL to Fiddler versus updating all the code below + # net-ssh did it first + module DL + CPtr ||= Fiddle::Pointer + if RUBY_PLATFORM != "java" + RUBY_FREE ||= Fiddle::RUBY_FREE + end + end +end module Locale # Locale::Driver::Win32 module for win32. @@ -30,8 +44,13 @@ module Locale # This is a low-level class. Application shouldn't use this directly. module Driver module Win32 + module Kernel32 - extend DL::Importer + if RUBY_VERSION < "2.1" + extend DL::Importer + else + extend Fiddle::Importer + end dlload "kernel32.dll" extern "int GetThreadLocale()" end diff --git a/lib/locale/version.rb b/lib/locale/version.rb index 65d52cc..b11ca14 100644 --- a/lib/locale/version.rb +++ b/lib/locale/version.rb @@ -7,6 +7,6 @@ license terms as Ruby. =end module Locale - VERSION = "2.0.9" + VERSION = "2.0.10" end diff --git a/locale.gemspec b/locale.gemspec index adcb0e8..f06ec20 100644 --- a/locale.gemspec +++ b/locale.gemspec @@ -44,6 +44,8 @@ Ruby-Locale is the pure ruby library which provides basic APIs for localization. s.test_files = Dir.glob("test/test_*.rb") end + s.required_ruby_version = "< 2.3.0" + s.add_development_dependency("rake") s.add_development_dependency("bundler") s.add_development_dependency("yard")