Class: ObjectsFramework::Server
- Inherits:
-
Object
- Object
- ObjectsFramework::Server
- Defined in:
- lib/objectsframework/server.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#env ⇒ Object
Returns the value of attribute env.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(config = {}) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(config = {}) ⇒ Server
Returns a new instance of Server.
5 6 7 |
# File 'lib/objectsframework/server.rb', line 5 def initialize(config = {}) @config = {:index_method => "index"}.merge(config) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/objectsframework/server.rb', line 3 def config @config end |
#env ⇒ Object
Returns the value of attribute env.
3 4 5 |
# File 'lib/objectsframework/server.rb', line 3 def env @env end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/objectsframework/server.rb', line 9 def call(env) @env = env request = Rack::Request.new(env) response = Rack::Response.new(env) # Solves some weird bug where ENV is added to the response body response.body = [] response.length = 0 # Set text/html as Content-type by default response.header["Content-type"] = "text/html" handler = ObjectsFramework::ObjectHandler.run_methods(request,response,self) if(handler === true) response.finish else return handler end end |