Class: EacRubyUtils::RootModuleSetup
- Defined in:
- lib/eac_ruby_utils/root_module_setup.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#root_module_file ⇒ Object
readonly
Returns the value of attribute root_module_file.
Class Method Summary collapse
Instance Method Summary collapse
- #ignore(path) ⇒ Object
-
#initialize(root_module_file, &block) ⇒ RootModuleSetup
constructor
A new instance of RootModuleSetup.
- #perform ⇒ void
- #root_module_directory ⇒ String
Constructor Details
#initialize(root_module_file, &block) ⇒ RootModuleSetup
Returns a new instance of RootModuleSetup.
19 20 21 22 |
# File 'lib/eac_ruby_utils/root_module_setup.rb', line 19 def initialize(root_module_file, &block) self.root_module_file = root_module_file self.block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
16 17 18 |
# File 'lib/eac_ruby_utils/root_module_setup.rb', line 16 def block @block end |
#root_module_file ⇒ Object
Returns the value of attribute root_module_file.
16 17 18 |
# File 'lib/eac_ruby_utils/root_module_setup.rb', line 16 def root_module_file @root_module_file end |
Class Method Details
.perform(root_module_file, &block) ⇒ Object
11 12 13 |
# File 'lib/eac_ruby_utils/root_module_setup.rb', line 11 def perform(root_module_file, &block) new(root_module_file, &block).perform end |
Instance Method Details
#ignore(path) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/eac_ruby_utils/root_module_setup.rb', line 25 def ignore(path) count_before = loader.send(:ignored_paths).count target_path = path.to_pathname.basename_sub { |b| "#{b.basename('.*')}.rb" } .(root_module_directory) result = loader.ignore target_path return result if result.count > count_before raise ::ArgumentError, [ "Trying to ignore path \"#{path}\" did not increase the ignored paths.", "Argument path: \"#{path}\"", "Target path: \"#{target_path}\"", "Ignored paths: #{result}" ].join("\n") end |
#perform ⇒ void
This method returns an undefined value.
39 40 41 42 |
# File 'lib/eac_ruby_utils/root_module_setup.rb', line 39 def perform perform_block perform_zeitwerk end |
#root_module_directory ⇒ String
45 46 47 48 |
# File 'lib/eac_ruby_utils/root_module_setup.rb', line 45 def root_module_directory ::File.(::File.basename(root_module_file, '.*'), ::File.dirname(root_module_file)) end |