Class: RuboCop::Cop::Style::RedundantCapitalW

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
PercentLiteral
Defined in:
lib/rubocop/cop/style/redundant_capital_w.rb

Overview

Checks for usage of the %W() syntax when %w() would do.

Examples:

# bad
%W(cat dog pig)
%W[door wall floor]

# good
%w/swim run bike/
%w[shirt pants shoes]
%W(apple #{fruit} grape)

Constant Summary collapse

MSG =
'Do not use `%W` unless interpolation is needed. If not, use `%w`.'

Instance Method Summary collapse

Methods included from AutoCorrector

support_autocorrect?

Instance Method Details

#on_array(node) ⇒ Object



23
24
25
# File 'lib/rubocop/cop/style/redundant_capital_w.rb', line 23

def on_array(node)
  process(node, '%W')
end