Class: ObjectsFramework::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/objectsframework/object.rb

Constant Summary collapse

@@hooks =

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]

All hooks are blocking, so they could eventually block the request [Future testing required]

[]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_hook(hook) ⇒ Object



30
31
32
# File 'lib/objectsframework/object.rb', line 30

def self.add_hook(hook)
  @@hooks << hook
end

.get_hooksObject



26
27
28
# File 'lib/objectsframework/object.rb', line 26

def self.get_hooks
  @@hooks
end

Instance Method Details

#requestObject



8
9
10
# File 'lib/objectsframework/object.rb', line 8

def request
  @request
end

#responseObject



12
13
14
# File 'lib/objectsframework/object.rb', line 12

def response
  @response
end

#set_instance_variables(request, response) ⇒ Object



3
4
5
6
# File 'lib/objectsframework/object.rb', line 3

def set_instance_variables(request,response)
  @request,@response = request,response
  return self;
end