Sha256: 522cbecb4d019bd525da8a6374d361ee03e8fe5d9c13f2d033d03ed15ece38a7

Contents?: true

Size: 826 Bytes

Versions: 1

Compression:

Stored size: 826 Bytes

Contents

require "grimm/version"
require "grimm/controller.rb"
require "grimm/utilities.rb"
require "grimm/dependencies.rb"
require "grimm/routing.rb"
require "pry"
require "grimm/orm/database_connector.rb"
require "grimm/orm/grimm_record.rb"


module Grimm
  class Application
    attr_reader :request
    def call(env)
      @request = Rack::Request.new(env)
      if request.path_info == "/favicon.ico"
        return [404,{}, []]
      end
      page = get_rack_app(env)
      if page.nil?
        return [404, {}, ["#{request.request_method.downcase} #{request.path} was not defined in the route. Check /config/routes.rb for defined routes"]]
      else
        page
      end
    end

    def route(&block)
      @router ||= Grimm::Router.new
    end

    def get_rack_app(env)
      @router.check_url(request)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grimm-0.0.3 lib/grimm.rb