lib/rubocop/cop/style/command_literal.rb in rubocop-0.56.0 vs lib/rubocop/cop/style/command_literal.rb in rubocop-0.57.0
- old
+ new
@@ -80,11 +80,11 @@
MSG_USE_BACKTICKS = 'Use backticks around command string.'.freeze
MSG_USE_PERCENT_X = 'Use `%x` around command string.'.freeze
def on_xstr(node)
- return if heredoc_literal?(node)
+ return if node.heredoc?
if backtick_literal?(node)
check_backtick_literal(node)
else
check_percent_x_literal(node)
@@ -157,13 +157,9 @@
end
def node_body(node)
loc = node.loc
loc.expression.source[loc.begin.length...-loc.end.length]
- end
-
- def heredoc_literal?(node)
- node.loc.respond_to?(:heredoc_body)
end
def backtick_literal?(node)
node.loc.begin.source == '`'
end