class_loader 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/class_loader.rb CHANGED
@@ -1,8 +1,13 @@
1
1
  autoload :ClassLoader, 'class_loader/class_loader'
2
2
 
3
3
  class Module
4
- alias_method :const_missing_without_autoload, :const_missing
4
+ alias_method :const_missing_without_cl, :const_missing
5
5
  def const_missing const
6
- ClassLoader.load(self, const) || const_missing_without_autoload(const)
6
+ ClassLoader.load(self, const) || begin
7
+ const_missing_without_cl(const)
8
+ rescue => e
9
+ # Removing ClassLoader from backtrace.
10
+ raise e.class, e.message, ClassLoader.filter_backtrace(e.backtrace)
11
+ end
7
12
  end
8
13
  end
@@ -94,6 +94,10 @@ module ClassLoader
94
94
  @watcher ||= ClassLoader::Watcher.new monitor
95
95
  end
96
96
 
97
+ def filter_backtrace backtrace
98
+ backtrace.reject{|path| path.include?("/lib/class_loader") or path.include?('monitor.rb')}
99
+ end
100
+
97
101
  protected
98
102
  # Use this method to define class name to file name mapping, by default it uses underscored paths,
99
103
  # but You can override this method to use camel case for example.
@@ -134,9 +138,5 @@ module ClassLoader
134
138
  ""
135
139
  end
136
140
  end
137
-
138
- def filter_backtrace backtrace
139
- backtrace.reject{|path| path.include?("/lib/class_loader") or path.include?('monitor.rb')}
140
- end
141
141
  end
142
142
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: class_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: