Class: Flows::SharedContextPipeline::Step Private

Inherits:
Struct
  • Object
show all
Defined in:
lib/flows/shared_context_pipeline/step.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.

Since:

  • 0.4.0

Direct Known Subclasses

MutationStep

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, body: nil, **rest) ⇒ Step

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:ManualDispatch

Since:

  • 0.4.0



8
9
10
11
12
13
14
15
# File 'lib/flows/shared_context_pipeline/step.rb', line 8

def initialize(name:, body: nil, **rest)
  if name.respond_to?(:call)
    body = name
    name = "#{body}+Step-Object-ID-#{object_id}"
  end

  super(name: name, body: body, **rest)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



6
7
8
# File 'lib/flows/shared_context_pipeline/step.rb', line 6

def body
  @body
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



6
7
8
# File 'lib/flows/shared_context_pipeline/step.rb', line 6

def name
  @name
end

#next_stepObject

Returns the value of attribute next_step

Returns:

  • (Object)

    the current value of next_step



6
7
8
# File 'lib/flows/shared_context_pipeline/step.rb', line 6

def next_step
  @next_step
end

#router_defObject

Returns the value of attribute router_def

Returns:

  • (Object)

    the current value of router_def



6
7
8
# File 'lib/flows/shared_context_pipeline/step.rb', line 6

def router_def
  @router_def
end

Instance Method Details

#to_node(pipeline_class) ⇒ 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.

Since:

  • 0.4.0



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/flows/shared_context_pipeline/step.rb', line 17

def to_node(pipeline_class)
  klass = self.class

  Flows::Flow::Node.new(
    body: body || pipeline_class.method(name),
    router: router_def.to_router(next_step),
    meta: { name: name },
    preprocessor: klass::NODE_PREPROCESSOR,
    postprocessor: klass::NODE_POSTPROCESSOR
  )
end