Class: Procedure::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/procedure/process.rb

Instance Method Summary collapse

Constructor Details

#initialize(context, steps) ⇒ Process

Returns a new instance of Process.



3
4
5
6
7
# File 'lib/procedure/process.rb', line 3

def initialize(context, steps)
  @context = context
  @steps = steps
  @passed = false
end

Instance Method Details

#callObject



29
30
31
32
33
34
35
36
# File 'lib/procedure/process.rb', line 29

def call
  @steps.each do |step_class|
    step = step_class.new(@context)
    outcome.add(step)

    break if outcome.failure?
  end
end

#failure?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/procedure/process.rb', line 13

def failure?
  !success?
end

#failure_codeObject



21
22
23
# File 'lib/procedure/process.rb', line 21

def failure_code
  outcome.failure_code
end

#failure_messageObject



17
18
19
# File 'lib/procedure/process.rb', line 17

def failure_message
  outcome.failure_message
end

#passed_stepsObject



25
26
27
# File 'lib/procedure/process.rb', line 25

def passed_steps
  outcome.passed_steps
end

#success?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/procedure/process.rb', line 9

def success?
  outcome.positive?
end