Sha256: de692ea6b147df267c7d81086378660dff020260bfb08ff90466a3adddc87695

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

require 'rails'
require_relative 'rails_options'

module Rack
  module DevMark
    class Railtie < Rails::Railtie
      config.rack_dev_mark = RailsOptions.new

      initializer "rack-dev-mark.configure_rails_initialization" do |app|
        if app.config.rack_dev_mark.enable || Rack::DevMark.rack_dev_mark_env
          racks = []

          insert_type = app.config.rack_dev_mark.insert_type
          insert_method = insert_type[0] || 'insert_before'
          racks << (insert_type[1] || ActionDispatch::ShowExceptions)

          racks << Rack::DevMark::Middleware
          if theme = app.config.rack_dev_mark.theme || app.config.rack_dev_mark.custom_theme
            racks << theme
          end

          app.config.app_middleware.send(insert_method, *racks)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-dev-mark-0.6.4 lib/rack/dev-mark/railtie.rb