lib/rubocop/cop/style/ternary_parentheses.rb in rubocop-0.62.0 vs lib/rubocop/cop/style/ternary_parentheses.rb in rubocop-0.63.0
- old
+ new
@@ -152,17 +152,15 @@
unparenthesized_method_call?(child)
end
end
def unparenthesized_method_call?(child)
- argument = method_call_argument(child)
-
- argument && !argument.parenthesized?
+ method_name(child) =~ /^[a-z]/i && !child.parenthesized?
end
- def_node_matcher :method_call_argument, <<-PATTERN
- {(:defined? $(send nil? _) ...)
- (send {_ nil?} _ $(send nil? _) ...)}
+ def_node_matcher :method_name, <<-PATTERN
+ {($:defined? (send nil? _) ...)
+ (send {_ nil?} $_ _ ...)}
PATTERN
def correct_parenthesized(condition)
lambda do |corrector|
corrector.remove(condition.loc.begin)