Skip to content

Commit

Permalink
Merge pull request #773 from ruby-concurrency/193
Browse files Browse the repository at this point in the history
Defensive 1.9.3 support
  • Loading branch information
pitr-ch committed Nov 6, 2018
2 parents 68a82c2 + cf28431 commit db8f88b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
10 changes: 9 additions & 1 deletion Rakefile
Expand Up @@ -2,7 +2,15 @@

require_relative 'lib/concurrent/version'
require_relative 'lib/concurrent/utility/engine'
require_relative 'lib/concurrent/utility/193'

if Concurrent.ruby_version :<, 2, 0, 0
# @!visibility private
module Kernel
def __dir__
File.dirname __FILE__
end
end
end

core_gemspec = Gem::Specification.load File.join(__dir__, 'concurrent-ruby.gemspec')
ext_gemspec = Gem::Specification.load File.join(__dir__, 'concurrent-ruby-ext.gemspec')
Expand Down
2 changes: 0 additions & 2 deletions lib/concurrent.rb
@@ -1,5 +1,3 @@
require 'concurrent/utility/193'

require 'concurrent/version'
require 'concurrent/constants'
require 'concurrent/errors'
Expand Down
17 changes: 0 additions & 17 deletions lib/concurrent/utility/193.rb

This file was deleted.

10 changes: 9 additions & 1 deletion lib/concurrent/utility/native_extension_loader.rb
Expand Up @@ -42,6 +42,14 @@ def load_native_extensions

private

def load_error_path(error)
if error.respond_to? :path
error.path
else
error.message.split(' -- ').last
end
end

def set_c_extensions_loaded
@c_extensions_loaded = true
end
Expand All @@ -54,7 +62,7 @@ def try_load_c_extension(path)
require path
set_c_extensions_loaded
rescue LoadError => e
if e.path == path
if load_error_path(e) == path
# move on with pure-Ruby implementations
# TODO (pitr-ch 12-Jul-2018): warning on verbose?
else
Expand Down

0 comments on commit db8f88b

Please sign in to comment.