Top Level Namespace
Defined Under Namespace
Modules: Spikard
Instance Method Summary collapse
- #on_error(&block) ⇒ Object
- #on_request(&block) ⇒ Object
- #on_response(&block) ⇒ Object
- #pre_handler(&block) ⇒ Object
- #pre_validation(&block) ⇒ Object
- #sse(path, &block) ⇒ Object
- #websocket(path, &block) ⇒ Object
Instance Method Details
#on_error(&block) ⇒ Object
25 26 27 28 29 |
# File 'lib/spikard/service_http_additions.rb', line 25 def on_error(&block) # Called when a handler returns an error. @lifecycle_hooks.push(["on_error", block]) self end |
#on_request(&block) ⇒ Object
1 2 3 4 5 |
# File 'lib/spikard/service_http_additions.rb', line 1 def on_request(&block) # Called before any other processing for each inbound request. @lifecycle_hooks.push(["on_request", block]) self end |
#on_response(&block) ⇒ Object
19 20 21 22 23 |
# File 'lib/spikard/service_http_additions.rb', line 19 def on_response(&block) # Called after the handler returns but before the response is serialized. @lifecycle_hooks.push(["on_response", block]) self end |
#pre_handler(&block) ⇒ Object
13 14 15 16 17 |
# File 'lib/spikard/service_http_additions.rb', line 13 def pre_handler(&block) # Called after validation but before invoking the route handler. @lifecycle_hooks.push(["pre_handler", block]) self end |
#pre_validation(&block) ⇒ Object
7 8 9 10 11 |
# File 'lib/spikard/service_http_additions.rb', line 7 def pre_validation(&block) # Called after parsing but before parameter validation. @lifecycle_hooks.push(["pre_validation", block]) self end |
#sse(path, &block) ⇒ Object
37 38 39 40 41 |
# File 'lib/spikard/service_http_additions.rb', line 37 def sse(path, &block) # Register an SSE event producer at the given path. @registrations.push(["sse", [path], block]) self end |
#websocket(path, &block) ⇒ Object
31 32 33 34 35 |
# File 'lib/spikard/service_http_additions.rb', line 31 def websocket(path, &block) # Register a WebSocket upgrade handler at the given path. @registrations.push(["websocket", [path], block]) self end |