Class: LogCabin::DirCollection
- Inherits:
-
BaseCollection
- Object
- BaseCollection
- LogCabin::DirCollection
- Defined in:
- lib/logcabin/dircollection.rb
Overview
Define a collection of modules in a local dir
Instance Attribute Summary collapse
-
#load_path ⇒ Object
readonly
Returns the value of attribute load_path.
Instance Method Summary collapse
-
#find(name) ⇒ Object
Method for finding modules to load.
-
#initialize(params = {}) ⇒ DirCollection
constructor
A new instance of DirCollection.
Constructor Details
#initialize(params = {}) ⇒ DirCollection
Returns a new instance of DirCollection.
7 8 9 10 11 |
# File 'lib/logcabin/dircollection.rb', line 7 def initialize(params = {}) @load_path = params[:load_path] || raise('Load path must be provided') @load_path = [@load_path] if @load_path.is_a? String super end |
Instance Attribute Details
#load_path ⇒ Object (readonly)
Returns the value of attribute load_path.
5 6 7 |
# File 'lib/logcabin/dircollection.rb', line 5 def load_path @load_path end |
Instance Method Details
#find(name) ⇒ Object
Method for finding modules to load
15 16 17 |
# File 'lib/logcabin/dircollection.rb', line 15 def find(name) cache(name) { load_class_from_module(find_file(name), name) } end |