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
21 22 23 24 25 |
# File 'lib/spikard/service_http_additions.rb', line 21 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
16 17 18 19 20 |
# File 'lib/spikard/service_http_additions.rb', line 16 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
11 12 13 14 15 |
# File 'lib/spikard/service_http_additions.rb', line 11 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
6 7 8 9 10 |
# File 'lib/spikard/service_http_additions.rb', line 6 def pre_validation(&block) # Called after parsing but before parameter validation. @lifecycle_hooks.push(["pre_validation", block]) self end |
#sse(path, &block) ⇒ Object
31 32 33 34 35 |
# File 'lib/spikard/service_http_additions.rb', line 31 def sse(path, &block) # Register an SSE event producer at the given path. @registrations.push(["sse", [path], block]) self end |
#websocket(path, &block) ⇒ Object
26 27 28 29 30 |
# File 'lib/spikard/service_http_additions.rb', line 26 def websocket(path, &block) # Register a WebSocket upgrade handler at the given path. @registrations.push(["websocket", [path], block]) self end |