class Cynic::App

Attributes

routing[R]

Public Class Methods

initialize!() click to toggle source
# File lib/cynic/app.rb, line 5
def self.initialize!
  Cynic.application = self.new
  require './config/routes'
  builder = Rack::Builder.new
  builder.use Rack::Static, :urls => ["/javascripts", "/stylesheets", "/images" "/bower_components"], :root => "public"
  builder.run Cynic.application
  builder
end
new() click to toggle source
# File lib/cynic/app.rb, line 14
def initialize
  Cynic.application = self
  @routing = Routing.new
end

Public Instance Methods

call(env) click to toggle source
# File lib/cynic/app.rb, line 19
def call(env)
  @env = env
  response.send
end
execute_controller_actions() click to toggle source
# File lib/cynic/app.rb, line 36
def execute_controller_actions
  route = self.routing_to_request
  
  route.params.each do |k,v|
    request.update_param(k, v)
  end
  route.object.request = request 
  
  route.object.response(route.method)
end
request() click to toggle source
# File lib/cynic/app.rb, line 24
def request
  Rack::Request.new(@env)
end
response() click to toggle source
# File lib/cynic/app.rb, line 32
def response
  Response.new(execute_controller_actions, request)
end
routing_to_request() click to toggle source
# File lib/cynic/app.rb, line 28
def routing_to_request
  routing.go_to request.request_method.downcase.to_sym, @env["REQUEST_PATH"]
end