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`.".freeze
RAILS_CONFIGURATION =
"Rails.configuration".freeze

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



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

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

#on_send(node) ⇒ Object



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

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