Class: CypressRails::InitializerHooks
- Inherits:
-
Object
- Object
- CypressRails::InitializerHooks
- Defined in:
- lib/cypress-rails/initializer_hooks.rb
Class Method Summary collapse
Instance Method Summary collapse
- #after_server_start(&blk) ⇒ Object
- #after_state_reset(&blk) ⇒ Object
- #after_transaction_start(&blk) ⇒ Object
- #before_server_start(&blk) ⇒ Object
- #before_server_stop(&blk) ⇒ Object
- #reset! ⇒ Object
- #run(name) ⇒ Object
Class Method Details
.instance ⇒ Object
7 8 9 |
# File 'lib/cypress-rails/initializer_hooks.rb', line 7 def self.instance @instance ||= new end |
Instance Method Details
#after_server_start(&blk) ⇒ Object
15 16 17 |
# File 'lib/cypress-rails/initializer_hooks.rb', line 15 def after_server_start(&blk) register(:after_server_start, blk) end |
#after_state_reset(&blk) ⇒ Object
23 24 25 |
# File 'lib/cypress-rails/initializer_hooks.rb', line 23 def after_state_reset(&blk) register(:after_state_reset, blk) end |
#after_transaction_start(&blk) ⇒ Object
19 20 21 |
# File 'lib/cypress-rails/initializer_hooks.rb', line 19 def after_transaction_start(&blk) register(:after_transaction_start, blk) end |
#before_server_start(&blk) ⇒ Object
11 12 13 |
# File 'lib/cypress-rails/initializer_hooks.rb', line 11 def before_server_start(&blk) register(:before_server_start, blk) end |
#before_server_stop(&blk) ⇒ Object
27 28 29 |
# File 'lib/cypress-rails/initializer_hooks.rb', line 27 def before_server_stop(&blk) register(:before_server_stop, blk) end |
#reset! ⇒ Object
31 32 33 |
# File 'lib/cypress-rails/initializer_hooks.rb', line 31 def reset! @hooks = {} end |
#run(name) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/cypress-rails/initializer_hooks.rb', line 35 def run(name) return unless @hooks[name] @hooks[name].each do |blk| blk.call end end |