Class: EacRubyBase1::RootModuleSetup
- Inherits:
-
Object
- Object
- EacRubyBase1::RootModuleSetup
- Defined in:
- lib/eac_ruby_base1/root_module_setup.rb,
lib/eac_ruby_base1/root_module_setup/paths.rb,
lib/eac_ruby_base1/root_module_setup/ignore.rb,
lib/eac_ruby_base1/root_module_setup/patches.rb,
lib/eac_ruby_base1/root_module_setup/requires.rb,
lib/eac_ruby_base1/root_module_setup/zeitwerk.rb,
lib/eac_ruby_base1/root_module_setup/require_patch.rb
Defined Under Namespace
Modules: Patches, Paths, Requires, Zeitwerk Classes: Ignore, RequirePatch
Constant Summary collapse
- DEFAULT_NAMESPACE =
::Object
- LIB_DIRECTORY_BASENAME =
'lib'
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#logging ⇒ Object
writeonly
Sets the attribute logging.
Class Method Summary collapse
Instance Method Summary collapse
- #extension_for ⇒ Module?
-
#initialize(root_module_file, &block) ⇒ RootModuleSetup
constructor
A new instance of RootModuleSetup.
- #namespace ⇒ Module
- #perform ⇒ void
- #root_module ⇒ void
Constructor Details
#initialize(root_module_file, &block) ⇒ RootModuleSetup
Returns a new instance of RootModuleSetup.
25 26 27 28 |
# File 'lib/eac_ruby_base1/root_module_setup.rb', line 25 def initialize(root_module_file, &block) self.root_module_file = root_module_file.to_pathname self.block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
21 22 23 |
# File 'lib/eac_ruby_base1/root_module_setup.rb', line 21 def block @block end |
#logging=(value) ⇒ Object (writeonly)
Sets the attribute logging
22 23 24 |
# File 'lib/eac_ruby_base1/root_module_setup.rb', line 22 def logging=(value) @logging = value end |
Class Method Details
.perform(root_module_file) ⇒ Object
16 17 18 |
# File 'lib/eac_ruby_base1/root_module_setup.rb', line 16 def perform(root_module_file, &) new(root_module_file, &).perform end |
Instance Method Details
#extension_for ⇒ Module?
31 32 33 34 35 36 37 |
# File 'lib/eac_ruby_base1/root_module_setup.rb', line 31 def extension_for dirname = ::File.dirname(relative_root_module_file) return nil if ['.', '/', ''].include?(dirname) require dirname ::ActiveSupport::Inflector.constantize(dirname.camelize) end |
#namespace ⇒ Module
40 41 42 |
# File 'lib/eac_ruby_base1/root_module_setup.rb', line 40 def namespace extension_for || DEFAULT_NAMESPACE end |
#perform ⇒ void
This method returns an undefined value.
45 46 47 48 49 50 51 |
# File 'lib/eac_ruby_base1/root_module_setup.rb', line 45 def perform perform_block perform_zeitwerk root_module perform_requires require_patches end |
#root_module ⇒ void
This method returns an undefined value.
54 55 56 57 58 |
# File 'lib/eac_ruby_base1/root_module_setup.rb', line 54 def root_module relative_root_module_file.each_filename.inject(DEFAULT_NAMESPACE) do |a, e| a.const_get(e.camelize) end end |