Class: ROM::AutoRegistration
- Inherits:
-
Object
- Object
- ROM::AutoRegistration
- Defined in:
- core/lib/rom/setup/auto_registration.rb
Overview
AutoRegistration is used to load component files automatically from the provided directory path
Constant Summary collapse
- NamespaceType =
Types::Strict::Bool | Types::Strict::String
- PathnameType =
Types.Constructor(Pathname, &Kernel.method(:Pathname))
- DEFAULT_MAPPING =
{ relations: :relations, mappers: :mappers, commands: :commands }.freeze
Instance Attribute Summary collapse
-
#component_dirs ⇒ Hash
readonly
Component => dir-name map.
-
#directory ⇒ Pathname
readonly
The root path.
-
#globs ⇒ Hash
readonly
File globbing functions for each component dir.
-
#namespace ⇒ Boolean, String
readonly
The name of the top level namespace or true/false which enables/disables default top level namespace inferred from the dir name.
Instance Attribute Details
#component_dirs ⇒ Hash (readonly)
Returns component => dir-name map.
42 |
# File 'core/lib/rom/setup/auto_registration.rb', line 42 option :component_dirs, type: Types::Strict::Hash, default: -> { DEFAULT_MAPPING } |
#directory ⇒ Pathname (readonly)
Returns The root path.
32 |
# File 'core/lib/rom/setup/auto_registration.rb', line 32 param :directory, type: PathnameType |
#globs ⇒ Hash (readonly)
Returns File globbing functions for each component dir.
46 47 48 49 50 51 52 |
# File 'core/lib/rom/setup/auto_registration.rb', line 46 option :globs, default: lambda { Hash[ component_dirs.map { |component, path| [component, directory.join("#{path}/**/*.rb")] } ] } |
#namespace ⇒ Boolean, String (readonly)
Returns The name of the top level namespace or true/false which enables/disables default top level namespace inferred from the dir name.
38 |
# File 'core/lib/rom/setup/auto_registration.rb', line 38 option :namespace, type: NamespaceType, default: -> { true } |