Module: Rack::App::SingletonMethods::Hooks

Included in:
Rack::App::SingletonMethods
Defined in:
lib/rack/app/singleton_methods/hooks.rb

Instance Method Summary collapse

Instance Method Details

#after(&block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/rack/app/singleton_methods/hooks.rb', line 11

def after(&block)
  @after_hooks ||= []
  unless block.nil?
    @after_hooks << ::Rack::App::Hook.new(class: self, &block)
  end
  @after_hooks
end

#before(&block) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/rack/app/singleton_methods/hooks.rb', line 3

def before(&block)
  @before_hooks ||= []
  unless block.nil?
    @before_hooks << ::Rack::App::Hook.new(class: self, &block)
  end
  @before_hooks
end