Exception: MissingSourceFile
- Defined in:
- lib/active_support/core_ext/load_error.rb
Overview
:nodoc:
Constant Summary collapse
- REGEXPS =
[ [/^no such file to load -- (.+)$/i, 1], [/^Missing \w+ (file\s*)?([^\s]+.rb)$/i, 2], [/^Missing API definition file in (.+)$/i, 1] ]
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, path) ⇒ MissingSourceFile
constructor
A new instance of MissingSourceFile.
- #is_missing?(path) ⇒ Boolean
Constructor Details
#initialize(message, path) ⇒ MissingSourceFile
Returns a new instance of MissingSourceFile.
3 4 5 6 |
# File 'lib/active_support/core_ext/load_error.rb', line 3 def initialize(, path) super() @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
2 3 4 |
# File 'lib/active_support/core_ext/load_error.rb', line 2 def path @path end |
Class Method Details
.from_message(message) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/active_support/core_ext/load_error.rb', line 12 def self.() REGEXPS.each do |regexp, capture| match = regexp.match() return MissingSourceFile.new(, match[capture]) unless match.nil? end nil end |
Instance Method Details
#is_missing?(path) ⇒ Boolean
8 9 10 |
# File 'lib/active_support/core_ext/load_error.rb', line 8 def is_missing?(path) path.gsub(/\.rb$/, '') == self.path.gsub(/\.rb$/, '') end |