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

Inherits:
RuboCop::Cop
  • Object
show all
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

#autocorrect(node) ⇒ Object



20
21
22
23
24
# File 'lib/rubocop/cop/ezcater/rails_configuration.rb', line 20

def autocorrect(node)
  lambda do |corrector|
    corrector.replace(node.source_range, RAILS_CONFIGURATION)
  end
end

#on_send(node) ⇒ Object



14
15
16
17
18
# File 'lib/rubocop/cop/ezcater/rails_configuration.rb', line 14

def on_send(node)
  rails_application_config(node) do
    add_offense(node, location: :expression, message: MSG)
  end
end