Sha256: ba91e623c0ebe30e0fd6a183c355abd6f20680e2ff6eb7107f624ee5fe36db92
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require "vundabar/version" require "json" require "active_support/inflector" require "vundabar/utilities" require "vundabar/dependencies" require "vundabar/routing/routing" require "vundabar/routing/mapper" require "vundabar/routing/route" require "vundabar/controller" require "pry" require "sqlite3" require "vundabar/orm/database" require "vundabar/orm/model_helper" require "vundabar/orm/associations" require "vundabar/orm/base_model" module Vundabar class Application attr_reader :routes def initialize @routes = Routing::Router.new end def call(env) request = Rack::Request.new(env) route = mapper.find_route(request) # return invalid_route_processor(request) unless route # call_controller_and_action(request, route[:klass_and_method]) # if route call_controller_and_action(request, route[:klass_and_method]) else invalid_route_processor(request) end end def mapper @mapper ||= Routing::Mapper.new(routes.endpoints) end def call_controller_and_action(request, klass_and_method) Routing::Route.new(request, klass_and_method).dispatcher end def invalid_route_processor(request) response = BaseController.new(request).invalid_route(routes.endpoints) [404, {}, [response]] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vundabar-0.2.0 | lib/vundabar.rb |