Class: Sapp::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/sapp/handler.rb

Overview

In charge of checking for a route match and setting the status, contains the unwrap method to call the handler proc in the context of this class. We need access to #params and #status

Instance Method Summary collapse

Constructor Details

#initialize(handler, request, keys) ⇒ Handler

Returns a new instance of Handler.



9
10
11
12
13
# File 'lib/sapp/handler.rb', line 9

def initialize handler, request, keys
  @handler = handler
  @request = request
  @keys    = keys
end

Instance Method Details

#statusObject



20
21
22
# File 'lib/sapp/handler.rb', line 20

def status
  @status
end

#unwrapObject



15
16
17
18
# File 'lib/sapp/handler.rb', line 15

def unwrap
  add_keys_to_params
  instance_eval(&handler)
end