Class: RuboCop::Cop::Obsession::Rails::CallbackOneMethod
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Obsession::Rails::CallbackOneMethod
- Includes:
- Helpers
- Defined in:
- lib/rubocop/cop/obsession/rails/callback_one_method.rb
Overview
This cop checks for Rails callbacks with multiple fields.
One method per callback definition makes the definition extra clear.
Constant Summary collapse
- MSG =
'Declare only one method per callback definition.'
Instance Method Summary collapse
Methods included from Helpers
Instance Method Details
#on_send(node) ⇒ Object
28 29 30 |
# File 'lib/rubocop/cop/obsession/rails/callback_one_method.rb', line 28 def on_send(node) on_callback(node) { |callback| add_offense(node) if rails_callback?(callback.to_s) } end |