Permalink
Browse files

Document LoadError core extensions

[ci skip]
  • Loading branch information...
1 parent 9efab21 commit d870cfd981d017fb39ae805832cbef773e7abc02 @stevenharman stevenharman committed Apr 11, 2014
Showing with 4 additions and 1 deletion.
  1. +4 −1 activesupport/lib/active_support/core_ext/load_error.rb
@@ -7,6 +7,7 @@ class LoadError
]
unless method_defined?(:path)
+ # Returns the path which was unable to be loaded.
def path
@path ||= begin
REGEXPS.find do |regex|
@@ -17,9 +18,11 @@ def path
end
end
+ # Returns <tt>true</tt> 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
+MissingSourceFile = LoadError

0 comments on commit d870cfd

Please sign in to comment.