Class: Rubocop::Cop::VariableInterpolation
- Defined in:
- lib/rubocop/cop/variable_interpolation.rb
Instance Attribute Summary
Attributes inherited from Cop
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, #has_report?, inherited, #initialize
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#inspect(file, source, tokens, sexp) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rubocop/cop/variable_interpolation.rb', line 6 def inspect(file, source, tokens, sexp) each(:string_dvar, sexp) do |s| var = s[1][1][1] lineno = s[1][1][2].lineno add_offence( :convention, lineno, "Replace interpolated var #{var} with expression \#{#{var}}." ) end end |