Class: Rubocop::Cop::NewLambdaLiteral
- Defined in:
- lib/rubocop/cop/new_lambda_literal.rb
Constant Summary collapse
- ERROR_MESSAGE =
'The new lambda literal syntax is preferred in Ruby 1.9.'
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
8 9 10 11 12 13 14 |
# File 'lib/rubocop/cop/new_lambda_literal.rb', line 8 def inspect(file, source, tokens, sexp) each(:fcall, sexp) do |s| if s[1][0..1] == [:@ident, 'lambda'] add_offence(:convention, s[1][-1].lineno, ERROR_MESSAGE) end end end |