Method: RuboCop::Cop::Style::ReturnNilInPredicateMethodDefinition#on_def

Defined in:
lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb

#on_def(node) ⇒ Object Also known as: on_defs



81
82
83
84
85
86
87
88
89
# File 'lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb', line 81

def on_def(node)
  return unless node.predicate_method?
  return if allowed_method?(node.method_name) || matches_allowed_pattern?(node.method_name)
  return unless (body = node.body)

  body.each_descendant(:return) { |return_node| handle_return(return_node) }

  handle_implicit_return_values(body)
end