class ObjectsFramework::Object
Public Class Methods
add_hook(hook)
click to toggle source
# File lib/objectsframework/object.rb, line 40 def self.add_hook(hook) @hooks << hook end
get_hooks()
click to toggle source
# File lib/objectsframework/object.rb, line 36 def self.get_hooks @hooks end
inherited(klass)
click to toggle source
Object
hooks: Usage: add_hook
:filter => “afilter”, :method => “yourmethod” Available hooks/filters (some are not implement yet, but planned):
-
object.before_execute: fired before your request handling method is called
-
request.finished: fired when the request is finished and the response is about to get served [planned]
-
server.ready: fired when the server is ready accepting connections [planned]
-
server.error: fired when an internal error happens (for example method not found) [planned]
-
request.capture: capture the request before anything happens, like a real pirate! (fired after your object is created)
if the result of your hook returns true, the request must be finished by your hook this can block the request
All hooks are blocking, so they could eventually block the request [Future testing required]
# File lib/objectsframework/object.rb, line 32 def self.inherited(klass) klass.instance_variable_set("@hooks", []) end
Public Instance Methods
continue()
click to toggle source
# File lib/objectsframework/object.rb, line 16 def continue return 0 end
request()
click to toggle source
# File lib/objectsframework/object.rb, line 8 def request @request end
response()
click to toggle source
# File lib/objectsframework/object.rb, line 12 def response @response end
set_instance_variables(request,response,env)
click to toggle source
# File lib/objectsframework/object.rb, line 3 def set_instance_variables(request,response,env) @request,@response,@env = request,response,env return self; end