Class: Yawl::Steps::Base
- Inherits:
-
Object
- Object
- Yawl::Steps::Base
- Defined in:
- lib/yawl/steps/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#output_io ⇒ Object
readonly
Returns the value of attribute output_io.
Class Method Summary collapse
Instance Method Summary collapse
- #attempts ⇒ Object
- #delay_between_attempts ⇒ Object
- #fatal! ⇒ Object
-
#initialize(process_step) ⇒ Base
constructor
A new instance of Base.
- #log(data, &block) ⇒ Object
- #name ⇒ Object
- #output ⇒ Object
- #process ⇒ Object
- #puts(*a) ⇒ Object
- #run_with_log ⇒ Object
- #sleep ⇒ Object
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_io ⇒ Object (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_steps ⇒ Object
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
#attempts ⇒ Object
84 85 86 |
# File 'lib/yawl/steps/base.rb', line 84 def attempts 3 end |
#delay_between_attempts ⇒ Object
88 89 90 |
# File 'lib/yawl/steps/base.rb', line 88 def delay_between_attempts 10 end |
#fatal! ⇒ Object
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 |
#name ⇒ Object
96 97 98 |
# File 'lib/yawl/steps/base.rb', line 96 def name self.class.name end |
#output ⇒ Object
80 81 82 |
# File 'lib/yawl/steps/base.rb', line 80 def output @output_io.string end |
#process ⇒ Object
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_log ⇒ Object
100 101 102 103 104 |
# File 'lib/yawl/steps/base.rb', line 100 def run_with_log log(fn: "run") do run end end |