Module: Halcyon::Application::Hooks::ClassMethods

Defined in:
lib/halcyon/application/hooks.rb

Instance Method Summary collapse

Instance Method Details

#shutdown(&hook) ⇒ Object

Sets the shutdown hook to the proc.

Close any resources opened in the startup hook.



30
31
32
# File 'lib/halcyon/application/hooks.rb', line 30

def shutdown &hook
  Halcyon.hooks[:shutdown] << hook
end

#startup(&hook) ⇒ Object

Sets the startup hook to the proc.

Use this to initialize application-wide resources, such as database connections.

Use initializers where possible.



22
23
24
# File 'lib/halcyon/application/hooks.rb', line 22

def startup &hook
  Halcyon.hooks[:startup] << hook
end