Class: RuboCop::Cop::Gusto::NoSend
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Gusto::NoSend
- Defined in:
- lib/rubocop/cop/gusto/no_send.rb
Overview
Do not call a private method via __send__
Constant Summary collapse
- MSG =
"Do not call a private method via `__send__`."- RESTRICT_ON_SEND =
%i(__send__).freeze
Instance Method Summary collapse
- #invoke_private_method_send?(node) ⇒ Object
- #on_send(node) ⇒ Object (also: #on_csend)
Instance Method Details
#invoke_private_method_send?(node) ⇒ Object
21 22 23 |
# File 'lib/rubocop/cop/gusto/no_send.rb', line 21 def_node_matcher :invoke_private_method_send?, <<~PATTERN (call _ :__send__ (sym _)) PATTERN |
#on_send(node) ⇒ Object Also known as: on_csend
25 26 27 |
# File 'lib/rubocop/cop/gusto/no_send.rb', line 25 def on_send(node) invoke_private_method_send?(node) { add_offense(node) } end |