Class: Substation::Environment::DSL
- Inherits:
-
Object
- Object
- Substation::Environment::DSL
- Defined in:
- lib/substation/environment/dsl.rb
Overview
The DSL class used to define register processors
Instance Attribute Summary collapse
-
#registry ⇒ Hash<Symbol, #call>
readonly
private
The registry of processors.
Class Method Summary collapse
-
.registry(&block) ⇒ Hash<Symbol, #call>
private
The registry of processors.
Instance Method Summary collapse
-
#initialize(&block) ⇒ undefined
constructor
private
Initialize a new instance.
-
#register(name, processor) ⇒ self
private
Register a new
processor
using the givenname
.
Constructor Details
#initialize(&block) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new instance
35 36 37 38 |
# File 'lib/substation/environment/dsl.rb', line 35 def initialize(&block) @registry = {} instance_eval(&block) if block end |
Instance Attribute Details
#registry ⇒ Hash<Symbol, #call> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The registry of processors
12 13 14 |
# File 'lib/substation/environment/dsl.rb', line 12 def registry @registry end |
Class Method Details
.registry(&block) ⇒ Hash<Symbol, #call>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The registry of processors
23 24 25 |
# File 'lib/substation/environment/dsl.rb', line 23 def self.registry(&block) new(&block).registry end |
Instance Method Details
#register(name, processor) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Register a new processor
using the given name
51 52 53 54 |
# File 'lib/substation/environment/dsl.rb', line 51 def register(name, processor) @registry[name] = processor self end |