lib/rubocop/cop/style/ternary_parentheses.rb in rubocop-0.43.0 vs lib/rubocop/cop/style/ternary_parentheses.rb in rubocop-0.44.0
- old
+ new
@@ -1,6 +1,5 @@
-# encoding: utf-8
# frozen_string_literal: true
module RuboCop
module Cop
module Style
@@ -89,10 +88,10 @@
def redundant_parentheses_enabled?
@config.for_cop('RedundantParentheses')['Enabled']
end
def parenthesized?(node)
- node.source =~ /^\(.*\)$/
+ node.begin_type?
end
# When this cop is configured to enforce parentheses and the
# `RedundantParentheses` cop is enabled, it will cause an infinite loop
# as they compete to add and remove the parentheses respectively.