class Rails::WebProfiler
Constants
- VERSION
Public Class Methods
initialize!(app)
click to toggle source
# File lib/rails/web_profiler/railtie.rb, line 3 def self.initialize!(app) raise "Rails::WebProfiler initialized twice. Set `require: false' for rails-webprofiler in your Gemfile" if @already_initialized app.middleware.insert(0, ::Rack::WebProfiler) ::Rack::WebProfiler.reset_collectors! ::Rack::WebProfiler.register_collectors [ ::Rack::WebProfiler::Collectors::RubyCollector, ::Rack::WebProfiler::Collectors::TimeCollector, Rails::WebProfiler::Collectors::ActionViewCollector, Rails::WebProfiler::Collectors::ActiveRecordCollector, Rails::WebProfiler::Collectors::RailsCollector, Rails::WebProfiler::Collectors::RequestCollector, ] # Subscrine all Rails notifications. handler = Rails::WebProfiler::NotificationHandler.new ActiveSupport::Notifications.subscribe(/.+/, handler) c = ::Rack::WebProfiler.config # c.skip_paths ||= [] # if serves_static_assets?(app) # c.skip_paths << app.config.assets.prefix # end # unless Rails.env.development? || Rails.env.test? # c.authorization_mode = :whitelist # end # if Rails.logger # c.logger = Rails.logger # end c.tmp_dir = ::File.expand_path(::File.join(Rails.root, "tmp"), __FILE__) @already_initialized = true end
serves_static_assets?(app)
click to toggle source
# File lib/rails/web_profiler/railtie.rb, line 44 def self.serves_static_assets?(app) config = app.config if !config.respond_to?(:assets) || !config.assets.respond_to?(:prefix) return false end if ::Rails.version >= "5.0.0" ::Rails.configuration.public_file_server.enabled elsif ::Rails.version >= "4.2.0" ::Rails.configuration.serve_static_files else ::Rails.configuration.serve_static_assets end end