Module: RequireDir
- Extended by:
- Forwardable, RequireDir
- Included in:
- RequireDir
- Defined in:
- lib/require_dir.rb,
lib/require_dir/loader.rb,
lib/require_dir/version.rb
Defined Under Namespace
Classes: Loader
Constant Summary collapse
- VERSION =
'0.1.2'
Instance Attribute Summary collapse
-
#loader ⇒ Object
Returns the value of attribute loader.
Instance Method Summary collapse
- #init(source, options = {}) ⇒ Object
- #init_with_offset(source, offset = 0, options = {}) ⇒ Object (also: #init_from_source)
- #project_folder_from(source:, offset: 0) ⇒ Object
Instance Attribute Details
#loader ⇒ Object
Returns the value of attribute loader.
5 6 7 |
# File 'lib/require_dir.rb', line 5 def loader @loader end |
Instance Method Details
#init(source, options = {}) ⇒ Object
18 19 20 |
# File 'lib/require_dir.rb', line 18 def init(source, = {}) init_with_offset(source, 0, ) end |
#init_with_offset(source, offset = 0, options = {}) ⇒ Object Also known as: init_from_source
13 14 15 16 |
# File 'lib/require_dir.rb', line 13 def init_with_offset(source, offset = 0, = {}) project_folder = project_folder_from(source: source, offset: offset) self.loader = RequireDir::Loader.new(project_folder, ) end |
#project_folder_from(source:, offset: 0) ⇒ Object
7 8 9 10 11 |
# File 'lib/require_dir.rb', line 7 def project_folder_from(source: , offset: 0) dirs_up = '' offset.times { dirs_up << '/..' } if offset > 0 File.dirname(File.(source + dirs_up)) end |