Class: Flows::Railway::StepList Private

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

#initializeStepList

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

Since:

  • 0.4.0



5
6
7
# File 'lib/flows/railway/step_list.rb', line 5

def initialize
  @list = []
end

Instance Method Details

#add(name:, lambda: nil) ⇒ 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



13
14
15
16
17
18
19
20
21
22
# File 'lib/flows/railway/step_list.rb', line 13

def add(name:, lambda: nil)
  step = Step.new(name: name, lambda: lambda)
  last_step = @list.last

  last_step.next_step = name if last_step

  @list << step

  self
end

#empty?Boolean

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:

  • (Boolean)

Since:

  • 0.4.0



33
34
35
# File 'lib/flows/railway/step_list.rb', line 33

def empty?
  @list.empty?
end

#first_step_nameObject

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



24
25
26
# File 'lib/flows/railway/step_list.rb', line 24

def first_step_name
  @list.first.name
end

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

Since:

  • 0.4.0



9
10
11
# File 'lib/flows/railway/step_list.rb', line 9

def initialize_dup(_other)
  @list = @list.map(&:dup)
end

#to_node_map(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.

:reek:FeatureEnvy is false positive here.

Since:

  • 0.4.0



29
30
31
# File 'lib/flows/railway/step_list.rb', line 29

def to_node_map(method_source)
  @list.map { |step| [step.name, step.to_node(method_source)] }.to_h
end