Class: Packwerk::Layer::Config
- Inherits:
-
Object
- Object
- Packwerk::Layer::Config
- Extended by:
- T::Sig
- Defined in:
- lib/packwerk/layer/config.rb
Constant Summary collapse
- ARCHITECTURE_VIOLATION_TYPE =
T.let('architecture', String)
- ARCHITECTURE_ENFORCE =
T.let('enforce_architecture', String)
- LAYER_VIOLATION_TYPE =
T.let('layer', String)
- LAYER_ENFORCE =
T.let('enforce_layers', String)
Instance Method Summary collapse
- #enforce_key ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #layers_key ⇒ Object
- #layers_key_configured? ⇒ Boolean
- #layers_list ⇒ Object
- #violation_key ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
15 16 17 18 |
# File 'lib/packwerk/layer/config.rb', line 15 def initialize @layers_key_configured = T.let(@layers_key_configured, T.nilable(T::Boolean)) @layers_list = T.let(@layers_list, T.nilable(T::Array[String])) end |
Instance Method Details
#enforce_key ⇒ Object
41 42 43 |
# File 'lib/packwerk/layer/config.rb', line 41 def enforce_key layers_key_configured? ? LAYER_ENFORCE : ARCHITECTURE_ENFORCE end |
#layers_key ⇒ Object
31 32 33 |
# File 'lib/packwerk/layer/config.rb', line 31 def layers_key layers_key_configured? ? 'layers' : 'architecture_layers' end |
#layers_key_configured? ⇒ Boolean
26 27 28 |
# File 'lib/packwerk/layer/config.rb', line 26 def layers_key_configured? @layers_key_configured ||= YAML.load_file('packwerk.yml')['architecture_layers'].nil? end |
#layers_list ⇒ Object
21 22 23 |
# File 'lib/packwerk/layer/config.rb', line 21 def layers_list @layers_list ||= YAML.load_file('packwerk.yml')[layers_key] || [] end |
#violation_key ⇒ Object
36 37 38 |
# File 'lib/packwerk/layer/config.rb', line 36 def violation_key layers_key_configured? ? LAYER_VIOLATION_TYPE : ARCHITECTURE_VIOLATION_TYPE end |