Class: Core::Pipeline::Actions::Block
- Inherits:
-
Core::Pipeline::Action
- Object
- Core::Pipeline::Action
- Core::Pipeline::Actions::Block
- Defined in:
- lib/core/pipeline/actions/block.rb
Overview
- public
-
A pipeline action defined as a block.
Instance Attribute Summary
Attributes inherited from Core::Pipeline::Action
Class Method Summary collapse
Instance Method Summary collapse
-
#finalize(context) ⇒ Object
[public].
-
#initialize(name = nil, before:, after:, &block) ⇒ Block
constructor
A new instance of Block.
Methods inherited from Core::Pipeline::Action
Constructor Details
#initialize(name = nil, before:, after:, &block) ⇒ Block
Returns a new instance of Block.
17 18 19 20 21 22 |
# File 'lib/core/pipeline/actions/block.rb', line 17 def initialize(name = nil, before:, after:, &block) @name = name || self.class.build_name @block = block super(before: before, after: after) end |
Class Method Details
.build_name ⇒ Object
12 13 14 |
# File 'lib/core/pipeline/actions/block.rb', line 12 def build_name "action_#{SecureRandom.hex(8)}" end |
Instance Method Details
#finalize(context) ⇒ Object
- public
26 27 28 29 |
# File 'lib/core/pipeline/actions/block.rb', line 26 def finalize(context) context.define_singleton_method(@name, &@block) context.method(@name).to_proc end |