Class: Substation::Chain::DSL
- Inherits:
-
Object
- Object
- Substation::Chain::DSL
- Defined in:
- lib/substation/chain/dsl.rb
Overview
The DSL class used to define chains in an Environment
Defined Under Namespace
Classes: Builder
Instance Attribute Summary collapse
-
#processors ⇒ Array<#call>
readonly
private
The processors to be used within a Substation::Chain.
Class Method Summary collapse
-
.processors(chain, &block) ⇒ Array<#call>
private
The processors to be used within a Substation::Chain.
Instance Method Summary collapse
-
#chain(other) ⇒ self
private
Nest the given chain within another one.
-
#initialize(processors, &block) ⇒ undefined
constructor
private
Initialize a new instance.
-
#use(processor) ⇒ self
private
Use the given
processor
within a chain.
Constructor Details
#initialize(processors, &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
131 132 133 134 135 |
# File 'lib/substation/chain/dsl.rb', line 131 def initialize(processors, &block) @processors = [] chain(processors) instance_eval(&block) if block end |
Instance Attribute Details
#processors ⇒ Array<#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 processors to be used within a Substation::Chain
103 104 105 |
# File 'lib/substation/chain/dsl.rb', line 103 def processors @processors end |
Class Method Details
.processors(chain, &block) ⇒ Array<#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 processors to be used within a Substation::Chain
116 117 118 |
# File 'lib/substation/chain/dsl.rb', line 116 def self.processors(chain, &block) new(chain, &block).processors end |
Instance Method Details
#chain(other) ⇒ 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.
Nest the given chain within another one
158 159 160 161 |
# File 'lib/substation/chain/dsl.rb', line 158 def chain(other) other.each { |handler| use(handler) } self end |
#use(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.
Use the given processor
within a chain
145 146 147 148 |
# File 'lib/substation/chain/dsl.rb', line 145 def use(processor) @processors << processor self end |