README.md in nxt_pipeline-0.2.3 vs README.md in nxt_pipeline-0.2.4
- old
+ new
@@ -128,9 +128,27 @@
# This will match all errors inheriting from StandardError
end
end
```
+### Before and After callbacks
+
+You can also define callbacks that run before and after the `#execute` action. Both callback blocks get the pipeline instance (to access stuff like the `log`) and the argument of the pipeline yielded.
+
+```ruby
+NxtPipeline::Pipeline.new do |p|
+ p.before_execute do |pipeline, arg|
+ # Will be called from within #execute before entering the first step
+ end
+
+ p.after_execute do |pipeline, arg|
+ # Will be called from within #execute after executing last step
+ end
+end
+```
+
+Note that the `after_execute` callback will not be called, when an error is raised in one of the steps. See the previous section (_Error callbacks_) for how to define callbacks that run in case of errors.
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.