lib/runger/rails/autoload.rb in runger_config-4.0.0 vs lib/runger/rails/autoload.rb in runger_config-5.0.0
- old
+ new
@@ -1,40 +1,38 @@
# frozen_string_literal: true
# This module is used to detect a Rails application and activate the corresponding plugins
# when Runger Config is loaded before Rails (e.g., in config/puma.rb).
-module Runger
- module Rails
- class << self
- attr_reader :tracer, :name_method
- attr_accessor :disable_postponed_load_warning
+module Runger::Rails
+ class << self
+ attr_reader :tracer, :name_method
+ attr_accessor :disable_postponed_load_warning
- private
+ private
- def tracepoint_class_callback(event)
- # Ignore singletons
- return if event.self.singleton_class?
+ def tracepoint_class_callback(event)
+ # Ignore singletons
+ return if event.self.singleton_class?
- # We wait till `rails/application/configuration.rb` has been loaded, since we rely on it
- # See https://github.com/palkan/runger_config/issues/134
- return unless name_method.bind_call(event.self) == "Rails::Application::Configuration"
+ # We wait till `rails/application/configuration.rb` has been loaded, since we rely on it
+ # See https://github.com/palkan/runger_config/issues/134
+ return unless name_method.bind_call(event.self) == 'Rails::Application::Configuration'
- tracer.disable
+ tracer.disable
- unless disable_postponed_load_warning
- warn "Runger Config was loaded before Rails. Activating Runger Config Rails plugins now.\n" \
- "NOTE: Already loaded configs were provisioned without Rails-specific sources."
- end
-
- require "runger/rails"
+ unless disable_postponed_load_warning
+ warn("Runger Config was loaded before Rails. Activating Runger Config Rails plugins now.\n" \
+ 'NOTE: Already loaded configs were provisioned without Rails-specific sources.')
end
- end
- # TruffleRuby doesn't support TracePoint's end event
- unless defined?(::TruffleRuby)
- @tracer = TracePoint.new(:end, &method(:tracepoint_class_callback))
- @tracer.enable
- # Use `Module#name` instead of `self.name` to handle overwritten `name` method
- @name_method = Module.instance_method(:name)
+ require 'runger/rails'
end
+ end
+
+ # TruffleRuby doesn't support TracePoint's end event
+ unless defined?(::TruffleRuby)
+ @tracer = TracePoint.new(:end, &method(:tracepoint_class_callback))
+ @tracer.enable
+ # Use `Module#name` instead of `self.name` to handle overwritten `name` method
+ @name_method = Module.instance_method(:name)
end
end