Class: Yawl::Steps::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/yawl/steps/base.rb

Direct Known Subclasses

RealStepMissing

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(process_step) ⇒ Base

Returns a new instance of Base.



71
72
73
74
# File 'lib/yawl/steps/base.rb', line 71

def initialize(process_step)
  @process_step = process_step
  @output_io = StringIO.new("")
end

Instance Attribute Details

#output_ioObject (readonly)

Returns the value of attribute output_io.



69
70
71
# File 'lib/yawl/steps/base.rb', line 69

def output_io
  @output_io
end

Class Method Details

.all_stepsObject



61
62
63
# File 'lib/yawl/steps/base.rb', line 61

def self.all_steps
  @all_steps ||= {}
end

.register(step) ⇒ Object



65
66
67
# File 'lib/yawl/steps/base.rb', line 65

def self.register(step)
  all_steps[step.name] = step
end

Instance Method Details

#attemptsObject



84
85
86
# File 'lib/yawl/steps/base.rb', line 84

def attempts
  3
end

#delay_between_attemptsObject



88
89
90
# File 'lib/yawl/steps/base.rb', line 88

def delay_between_attempts
  10
end

#fatal!Object

Raises:



110
111
112
# File 'lib/yawl/steps/base.rb', line 110

def fatal!
  raise Step::Fatal
end

#log(data, &block) ⇒ Object



114
115
116
# File 'lib/yawl/steps/base.rb', line 114

def log(data, &block)
  Log.log({ ns: "yawl-step_#{name}" }.merge(data), &block)
end

#nameObject



96
97
98
# File 'lib/yawl/steps/base.rb', line 96

def name
  self.class.name
end

#outputObject



80
81
82
# File 'lib/yawl/steps/base.rb', line 80

def output
  @output_io.string
end

#processObject



92
93
94
# File 'lib/yawl/steps/base.rb', line 92

def process
  @process_step.process
end

#puts(*a) ⇒ Object



76
77
78
# File 'lib/yawl/steps/base.rb', line 76

def puts(*a)
  @output_io.puts(*a)
end

#run_with_logObject



100
101
102
103
104
# File 'lib/yawl/steps/base.rb', line 100

def run_with_log
  log(fn: "run") do
    run
  end
end

#sleepObject

Raises:



106
107
108
# File 'lib/yawl/steps/base.rb', line 106

def sleep
  raise Step::Tired
end