Method: RuboCop::Cop::Style::NumericPredicate#on_send
- Defined in:
- lib/rubocop/cop/style/numeric_predicate.rb
#on_send(node) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/rubocop/cop/style/numeric_predicate.rb', line 90 def on_send(node) numeric, replacement = check(node) return unless numeric return if allowed_method_name?(node.method_name) || node.each_ancestor(:send, :block).any? do |ancestor| allowed_method_name?(ancestor.method_name) end = format(MSG, prefer: replacement, current: node.source) add_offense(node, message: ) do |corrector| corrector.replace(node, replacement) end end |