Class: EcsRails::Config
- Inherits:
-
Object
- Object
- EcsRails::Config
- Defined in:
- lib/ecs_rails/config.rb
Overview
Generator configuration for the directory layout (ADR-0010).
The gem RUNTIME never reads this: entities and components are keyed by class
name (RFC-0002) and by the model discriminator (ADR-0002), so the registry
does not care where a class file lives. This object exists purely so the
generators (RFC-0008) know where to write, and so the initializer they emit
can echo the chosen path.
entities_path is the single knob. Components always live in a components
subdirectory of it, which is why components_path is derived rather than
separately settable — ADR-0010 deliberately exposes one path, not two.
Instance Attribute Summary collapse
-
#entities_path ⇒ String
Entities land here; the default is the ADR-0010 layout.
Instance Method Summary collapse
-
#components_path ⇒ String
Components live in a
componentssubdirectory of the entities path. -
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
27 28 29 |
# File 'lib/ecs_rails/config.rb', line 27 def initialize @entities_path = "app/entities" end |
Instance Attribute Details
#entities_path ⇒ String
Entities land here; the default is the ADR-0010 layout. Set it to
"app/models" to restore the pre-ADR-0010 single-directory layout.
25 26 27 |
# File 'lib/ecs_rails/config.rb', line 25 def entities_path @entities_path end |
Instance Method Details
#components_path ⇒ String
Components live in a components subdirectory of the entities path. The
generated initializer collapses this directory so Zeitwerk treats the
components/ segment as transparent (ADR-0010 “How it works”).
Derived rather than separately settable: ADR-0010 deliberately exposes one path, not two.
40 41 42 |
# File 'lib/ecs_rails/config.rb', line 40 def components_path "#{entities_path}/components" end |