Class: Flows::SharedContextPipeline::Wrap Private
- Inherits:
-
Object
- Object
- Flows::SharedContextPipeline::Wrap
- Defined in:
- lib/flows/shared_context_pipeline/wrap.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- EMPTY_HASH =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{}.freeze
- NODE_PREPROCESSOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
lambda do |_input, context, | [[context], EMPTY_HASH] end
- NODE_POSTPROCESSOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
lambda do |result, context, | context[:data].merge!(result.instance_variable_get(:@data)) result end
Instance Attribute Summary collapse
-
#next_step ⇒ Object
private
:reek:Attribute.
- #router_def ⇒ Object readonly private
- #tracks_definitions ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(method_name:, router_def:, &tracks_definitions) ⇒ Wrap
constructor
private
A new instance of Wrap.
-
#initialize_dup(other) ⇒ Object
private
on
#dup
we're getting new empty singleton class so we need to initialize it like original one. - #name ⇒ Object private
- #to_node(method_source) ⇒ Object private
Constructor Details
#initialize(method_name:, router_def:, &tracks_definitions) ⇒ Wrap
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.
Returns a new instance of Wrap.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flows/shared_context_pipeline/wrap.rb', line 22 def initialize(method_name:, router_def:, &tracks_definitions) @method_name = method_name @router_def = router_def @tracks_definitions = tracks_definitions singleton_class.extend DSL::Tracks singleton_class.extend Result::Helpers singleton_class.instance_exec(&tracks_definitions) end |
Instance Attribute Details
#next_step ⇒ Object
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.
:reek:Attribute
8 9 10 |
# File 'lib/flows/shared_context_pipeline/wrap.rb', line 8 def next_step @next_step end |
#router_def ⇒ Object (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.
5 6 7 |
# File 'lib/flows/shared_context_pipeline/wrap.rb', line 5 def router_def @router_def end |
#tracks_definitions ⇒ Object (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.
5 6 7 |
# File 'lib/flows/shared_context_pipeline/wrap.rb', line 5 def tracks_definitions @tracks_definitions end |
Instance Method Details
#initialize_dup(other) ⇒ Object
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.
on #dup
we're getting new empty singleton class
so we need to initialize it like original one
35 36 37 38 39 |
# File 'lib/flows/shared_context_pipeline/wrap.rb', line 35 def initialize_dup(other) singleton_class.extend DSL::Tracks singleton_class.extend Result::Helpers singleton_class.instance_exec(&other.tracks_definitions) end |
#name ⇒ Object
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.
41 42 43 |
# File 'lib/flows/shared_context_pipeline/wrap.rb', line 41 def name singleton_class.tracks.first_step_name end |
#to_node(method_source) ⇒ Object
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.
45 46 47 48 49 50 51 52 53 |
# File 'lib/flows/shared_context_pipeline/wrap.rb', line 45 def to_node(method_source) Flows::Flow::Node.new( body: make_body(method_source), router: router_def.to_router(next_step), meta: { wrap_name: @method_name }, preprocessor: NODE_PREPROCESSOR, postprocessor: NODE_POSTPROCESSOR ) end |