Class: RuboCop::Cop::Ezcater::RailsConfiguration

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/ezcater/rails_configuration.rb

Constant Summary collapse

MSG =
"Use `Rails.configuration` instead of `Rails.application.config`."
RAILS_CONFIGURATION =
"Rails.configuration"

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rubocop/cop/ezcater/rails_configuration.rb', line 16

def on_send(node)
  rails_application_config(node) do
    add_offense(node.loc.expression, message: MSG) do |corrector|
      corrector.replace(node.source_range, RAILS_CONFIGURATION)
    end
  end
end