Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add a debug option to load_constants

  • Loading branch information...
commit c51ef116f38e5192171112f347f9a2ba050fe636 1 parent 3d4186a
Sven Fuchs svenfuchs authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/core_ext/module/load_constants.rb
4 lib/core_ext/module/load_constants.rb
View
@@ -1,9 +1,10 @@
class Module
class Preloader
- attr_reader :skip_patterns, :skip_names
+ attr_reader :skip_patterns, :skip_names, :debug
def initialize(options)
skip = options[:skip] || []
+ @debug = options[:debug]
@skip_patterns, @skip_names = skip.partition do |skip|
skip.is_a?(Regexp)
end
@@ -14,6 +15,7 @@ def load_constants(const)
full_name = [const.name, name].join('::')
unless skip?(full_name)
skip_names << full_name
+ puts "preloading #{full_name}" if debug
child = begin
const.const_get(name)
rescue NameError => e
Please sign in to comment.
Something went wrong with that request. Please try again.