Sha256: 45d89f8779b83540c86293a56addc0c05088ceadda801e551c40af94c8fca014

Contents?: true

Size: 888 Bytes

Versions: 40

Compression:

Stored size: 888 Bytes

Contents

require "active_support/deprecation"
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

40 entries across 39 versions & 7 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.7.1/lib/active_support/core_ext/load_error.rb
activesupport-5.0.7.2 lib/active_support/core_ext/load_error.rb
activesupport-5.0.7.1 lib/active_support/core_ext/load_error.rb
activesupport-5.0.7 lib/active_support/core_ext/load_error.rb
activesupport-5.0.6 lib/active_support/core_ext/load_error.rb
activesupport-5.0.6.rc1 lib/active_support/core_ext/load_error.rb
activesupport-5.0.5 lib/active_support/core_ext/load_error.rb
activesupport-5.0.5.rc2 lib/active_support/core_ext/load_error.rb
activesupport-5.0.5.rc1 lib/active_support/core_ext/load_error.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/load_error.rb
tdiary-5.0.5 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/load_error.rb
activesupport-5.0.4 lib/active_support/core_ext/load_error.rb
activesupport-5.0.4.rc1 lib/active_support/core_ext/load_error.rb
activesupport-5.0.3 lib/active_support/core_ext/load_error.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activesupport-5.0.2/lib/active_support/core_ext/load_error.rb
lazy_record-0.2.1 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/load_error.rb
lazy_record-0.2.0 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/load_error.rb
lazy_record-0.1.9 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/load_error.rb
lazy_record-0.1.8 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/load_error.rb
lazy_record-0.1.7 vendor/bundle/gems/activesupport-5.0.2/lib/active_support/core_ext/load_error.rb