aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application.rb
blob: cadfc5010b0571e6439eba77ff1ae71e0d130633 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Rails
  class Application
    attr_accessor :routes, :config

    def self.load(environment_file)
      environment = File.read(environment_file)
      Object.class_eval(environment, environment_file)
    end

    def initialize
      @routes = ActionController::Routing::Routes
    end

    def middleware
      config.middleware
    end

    def call(env)
      @app ||= middleware.build(@routes)
      @app.call(env)
    end
  end
end