Class: ConventionalExtensions::Loader
- Inherits:
-
Object
- Object
- ConventionalExtensions::Loader
- Defined in:
- lib/conventional_extensions/loader.rb
Instance Method Summary collapse
-
#initialize(klass, path) ⇒ Loader
constructor
A new instance of Loader.
- #load(*extensions) ⇒ Object
Constructor Details
#initialize(klass, path) ⇒ Loader
Returns a new instance of Loader.
6 7 8 9 |
# File 'lib/conventional_extensions/loader.rb', line 6 def initialize(klass, path) @loaded, @klass, @matcher = Set.new, klass, /\s*class #{klass.name}/ @path_format = File.join path.sub(/\.rb$/, "/extensions/%s.rb") end |
Instance Method Details
#load(*extensions) ⇒ Object
11 12 13 14 |
# File 'lib/conventional_extensions/loader.rb', line 11 def load(*extensions) paths = extensions.empty? ? extension_paths : extensions.map { extension_path_for _1 } paths.each { load_one _1 } end |