Class: Flows::SharedContextPipeline::RouterDefinition Private

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

Instance Method Summary collapse

Constructor Details

#initialize(routes = {}) ⇒ RouterDefinition

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 RouterDefinition.

Since:

  • 0.4.0



5
6
7
# File 'lib/flows/shared_context_pipeline/router_definition.rb', line 5

def initialize(routes = {})
  @routes = routes
end

Instance Method Details

#to_router(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:ControlParameter is false positive here

Since:

  • 0.4.0



10
11
12
13
14
15
16
17
18
# File 'lib/flows/shared_context_pipeline/router_definition.rb', line 10

def to_router(next_step)
  final_routes = @routes.transform_values do |route|
    next route unless route == :next

    next_step || :end
  end

  ::Flows::Flow::Router::Custom.new(final_routes)
end