Module: Kernel

Defined in:
lib/reactive-core/ext/rubygems_activate_patch.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#require(path) ⇒ Object

:doc:



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/reactive-core/ext/rubygems_activate_patch.rb', line 120

def require(path) # :doc:
  gem_original_require path
rescue LoadError => load_error
  if load_error.message =~ /#{Regexp.escape path}\z/ and
     !(specs = Gem.searcher.find_all(path)).blank? then
    exception = specs.inject(nil) do |except, spec|
      begin
        Gem.activate(spec.name, "= #{spec.version}")
        break nil
      rescue Gem::Exception => e
        e
      end
    end
    raise exception if exception === Exception
    gem_original_require path
  else
    raise load_error
  end
end