Class: Rack::App::Hook
- Inherits:
-
Object
- Object
- Rack::App::Hook
- Defined in:
- lib/rack/app/hook.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#Class ⇒ Object
Returns the value of attribute Class.
Instance Method Summary collapse
- #exec(env) ⇒ Object
-
#initialize(options = {}, &block) ⇒ Hook
constructor
A new instance of Hook.
Constructor Details
#initialize(options = {}, &block) ⇒ Hook
Returns a new instance of Hook.
5 6 7 8 |
# File 'lib/rack/app/hook.rb', line 5 def initialize( = {}, &block) self.Class = [:class] || raise(ArgumentError, "missing :class keyword argument") self.block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
3 4 5 |
# File 'lib/rack/app/hook.rb', line 3 def block @block end |
#Class ⇒ Object
Returns the value of attribute Class.
3 4 5 |
# File 'lib/rack/app/hook.rb', line 3 def Class @Class end |
Instance Method Details
#exec(env) ⇒ Object
10 11 12 |
# File 'lib/rack/app/hook.rb', line 10 def exec(env) env[Rack::App::Constants::ENV::HANDLERS].get(self.Class).instance_exec(&self.block) end |