Class: WFlow::Flow

Inherits:
Object
  • Object
show all
Defined in:
lib/w_flow/flow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Flow

Returns a new instance of Flow.



6
7
8
9
10
# File 'lib/w_flow/flow.rb', line 6

def initialize(params)
  @data        = Data.new(params)
  @failure     = false
  @failure_log = []
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/w_flow/flow.rb', line 4

def data
  @data
end

#failure_logObject (readonly)

Returns the value of attribute failure_log.



4
5
6
# File 'lib/w_flow/flow.rb', line 4

def failure_log
  @failure_log
end

Instance Method Details

#failure!(message = nil) ⇒ Object



20
21
22
# File 'lib/w_flow/flow.rb', line 20

def failure!(message = nil)
  Supervisor.signal_failure!(message)
end

#failure?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/w_flow/flow.rb', line 28

def failure?
  @failure
end

#log_failure(message) ⇒ Object



32
33
34
# File 'lib/w_flow/flow.rb', line 32

def log_failure(message)
  @failure_log << message unless message.nil?
end

#set_failure_and_log(message) ⇒ Object



36
37
38
39
# File 'lib/w_flow/flow.rb', line 36

def set_failure_and_log(message)
  @failure = true
  log_failure(message)
end

#skip!Object



12
13
14
# File 'lib/w_flow/flow.rb', line 12

def skip!
  Supervisor.signal_skip!
end

#stop!Object



16
17
18
# File 'lib/w_flow/flow.rb', line 16

def stop!
  Supervisor.signal_stop!
end

#success?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/w_flow/flow.rb', line 24

def success?
  !failure?
end