Sha256: a0e35895e8d2cefef1315ffb4e36c9315fea0c74681725983852d4cd3e2f6ec2
Contents?: true
Size: 797 Bytes
Versions: 2
Compression:
Stored size: 797 Bytes
Contents
class MissingSourceFile < LoadError #:nodoc: attr_reader :path def initialize(message, path) super(message) @path = path end def is_missing?(path) path.gsub(/\.rb$/, '') == self.path.gsub(/\.rb$/, '') end def self.from_message(message) REGEXPS.each do |regexp, capture| match = regexp.match(message) return MissingSourceFile.new(message, match[capture]) unless match.nil? end nil end REGEXPS = [ [/^no such file to load -- (.+)$/i, 1], [/^Missing \w+ (file\s*)?([^\s]+.rb)$/i, 2], [/^Missing API definition file in (.+)$/i, 1], [/win32/, 0] ] unless defined?(REGEXPS) end class LoadError def self.new(*args) if self == LoadError MissingSourceFile.from_message(args.first) else super end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
activesupport-3.0.pre | lib/active_support/core_ext/load_error.rb |
recliner-0.0.1 | vendor/activesupport/lib/active_support/core_ext/load_error.rb |