Module: RSpec::Multicore::Hooks
- Defined in:
- lib/rspec/multicore/configuration.rb
Overview
Stores process lifecycle hooks independently of RSpec configuration.
Class Method Summary collapse
- .clear! ⇒ Object
- .on_fork(&block) ⇒ Object
- .on_shutdown(&block) ⇒ Object
- .run_fork(slot) ⇒ Object
- .run_shutdown(slot) ⇒ Object
Class Method Details
.clear! ⇒ Object
65 66 67 68 |
# File 'lib/rspec/multicore/configuration.rb', line 65 def clear! fork_hooks.clear shutdown_hooks.clear end |
.on_fork(&block) ⇒ Object
50 |
# File 'lib/rspec/multicore/configuration.rb', line 50 def on_fork(&block) = (fork_hooks << block if block) |
.on_shutdown(&block) ⇒ Object
52 |
# File 'lib/rspec/multicore/configuration.rb', line 52 def on_shutdown(&block) = (shutdown_hooks << block if block) |
.run_fork(slot) ⇒ Object
54 |
# File 'lib/rspec/multicore/configuration.rb', line 54 def run_fork(slot) = fork_hooks.each { _1.call(slot) } |
.run_shutdown(slot) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/rspec/multicore/configuration.rb', line 56 def run_shutdown(slot) shutdown_hooks.reverse_each.filter_map do |hook| hook.call(slot) nil rescue StandardError => e e end end |