Sha256: 69b73901bdefe49f253455933ec029389050a0de73c8c46478dc0c71989b0087

Contents?: true

Size: 409 Bytes

Versions: 3

Compression:

Stored size: 409 Bytes

Contents

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

  def path
    @path ||= begin
      REGEXPS.find do |regex|
        message =~ regex
      end
      $1
    end
  end

  def is_missing?(location)
    location.sub(/\.rb$/, '') == path.sub(/\.rb$/, '')
  end
end

MissingSourceFile = LoadError

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activesupport-3.0.0.beta3 lib/active_support/core_ext/load_error.rb
activesupport-3.0.0.beta2 lib/active_support/core_ext/load_error.rb
activesupport-3.0.0.beta lib/active_support/core_ext/load_error.rb