Class: Etcher::Registry
- Inherits:
-
Data
- Object
- Data
- Etcher::Registry
- Defined in:
- lib/etcher/registry.rb
Overview
Provides a registry of customization for loading and resolving a configuration.
Instance Attribute Summary collapse
-
#contract ⇒ Object
readonly
Returns the value of attribute contract.
-
#loaders ⇒ Object
readonly
Returns the value of attribute loaders.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#transformers ⇒ Object
readonly
Returns the value of attribute transformers.
Class Method Summary collapse
Instance Method Summary collapse
- #add_loader(loader) ⇒ Object
- #add_transformer(transformer) ⇒ Object
-
#initialize(contract: Contract, model: Hash, loaders: [], transformers: []) ⇒ Registry
constructor
A new instance of Registry.
- #remove_loader(index) ⇒ Object
- #remove_transformer(index) ⇒ Object
Constructor Details
Instance Attribute Details
#contract ⇒ Object (readonly)
Returns the value of attribute contract
5 6 7 |
# File 'lib/etcher/registry.rb', line 5 def contract @contract end |
#loaders ⇒ Object (readonly)
Returns the value of attribute loaders
5 6 7 |
# File 'lib/etcher/registry.rb', line 5 def loaders @loaders end |
#model ⇒ Object (readonly)
Returns the value of attribute model
5 6 7 |
# File 'lib/etcher/registry.rb', line 5 def model @model end |
#transformers ⇒ Object (readonly)
Returns the value of attribute transformers
5 6 7 |
# File 'lib/etcher/registry.rb', line 5 def transformers @transformers end |
Class Method Details
.find(namespace, moniker, logger: LOGGER) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/etcher/registry.rb', line 6 def self.find namespace, moniker, logger: LOGGER case Finder.call namespace, moniker in Success(constant) then constant in Failure() then logger.abort else logger.abort "Unable to find constant in registry." end end |
Instance Method Details
#add_loader(loader) ⇒ Object
18 |
# File 'lib/etcher/registry.rb', line 18 def add_loader(loader, ...) = add(loader, :Loaders, ...) |
#add_transformer(transformer) ⇒ Object
22 |
# File 'lib/etcher/registry.rb', line 22 def add_transformer(transformer, ...) = add(transformer, :Transformers, ...) |
#remove_loader(index) ⇒ Object
20 |
# File 'lib/etcher/registry.rb', line 20 def remove_loader(index) = remove index, loaders |
#remove_transformer(index) ⇒ Object
24 |
# File 'lib/etcher/registry.rb', line 24 def remove_transformer(index) = remove index, transformers |