class ObjectsFramework::Server

Attributes

config[RW]
env[RW]

Public Class Methods

new(config = {}) click to toggle source
# File lib/objectsframework/server.rb, line 5
def initialize(config = {})
  @config = {:index_method => "index"}.merge(config)
end

Public Instance Methods

call(env) click to toggle source
# 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