Sha256: d66abd95cf8a290ef2ab58d46628945229eb96dbfbe5dc9bc3c64f74e6000c23

Contents?: true

Size: 851 Bytes

Versions: 12

Compression:

Stored size: 851 Bytes

Contents

require 'active_support/deprecation/proxy_wrappers'

class LoadError
  REGEXPS = [
    /^no such file to load -- (.+)$/i,
    /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
    /^Missing API definition file in (.+)$/i,
    /^cannot load such file -- (.+)$/i,
  ]

  unless method_defined?(:path)
    # Returns the path which was unable to be loaded.
    def path
      @path ||= begin
        REGEXPS.find do |regex|
          message =~ regex
        end
        $1
      end
    end
  end

  # Returns true if the given path name (except perhaps for the ".rb"
  # extension) is the missing file which caused the exception to be raised.
  def is_missing?(location)
    location.sub(/\.rb$/, ''.freeze) == path.sub(/\.rb$/, ''.freeze)
  end
end

MissingSourceFile = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('MissingSourceFile', 'LoadError')

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/activesupport-5.0.0/lib/active_support/core_ext/load_error.rb
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.1 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.rc2 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.racecar1 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.rc1 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.beta4 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.beta3 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.beta2 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.beta1.1 lib/active_support/core_ext/load_error.rb
activesupport-5.0.0.beta1 lib/active_support/core_ext/load_error.rb