Sha256: e18c53616e7b3dc41d4c2aafee87dc642a83be15cc04196cb4aef24b020d6146

Contents?: true

Size: 704 Bytes

Versions: 56

Compression:

Stored size: 704 Bytes

Contents

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$/, '') == path.sub(/\.rb$/, '')
  end
end

MissingSourceFile = LoadError

Version data entries

56 entries across 54 versions & 10 rubygems

Version Path
activesupport-4.2.11.3 lib/active_support/core_ext/load_error.rb
activesupport-4.2.11.2 lib/active_support/core_ext/load_error.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/core_ext/load_error.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/core_ext/load_error.rb
activesupport-4.2.11.1 lib/active_support/core_ext/load_error.rb
activesupport-4.2.11 lib/active_support/core_ext/load_error.rb
activesupport-4.2.10 lib/active_support/core_ext/load_error.rb
activesupport-4.2.10.rc1 lib/active_support/core_ext/load_error.rb
activesupport-4.2.9 lib/active_support/core_ext/load_error.rb
activesupport-4.2.9.rc2 lib/active_support/core_ext/load_error.rb
activesupport-4.2.9.rc1 lib/active_support/core_ext/load_error.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activesupport-4.2.8/lib/active_support/core_ext/load_error.rb
activesupport-4.2.8 lib/active_support/core_ext/load_error.rb
activesupport-4.2.8.rc1 lib/active_support/core_ext/load_error.rb
activesupport-4.2.7.1 lib/active_support/core_ext/load_error.rb
activesupport-4.2.7 lib/active_support/core_ext/load_error.rb
activesupport-4.2.7.rc1 lib/active_support/core_ext/load_error.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.6/lib/active_support/core_ext/load_error.rb
activesupport-4.2.6 lib/active_support/core_ext/load_error.rb
activesupport-4.2.6.rc1 lib/active_support/core_ext/load_error.rb