lib/rubocop/cop/alias.rb in rubocop-0.6.1 vs lib/rubocop/cop/alias.rb in rubocop-0.7.0
- old
+ new
@@ -4,14 +4,11 @@
module Cop
class Alias < Cop
ERROR_MESSAGE = 'Use alias_method instead of alias.'
def inspect(file, source, tokens, sexp)
- tokens.each_index do |ix|
- t = tokens[ix]
- if t.type == :on_kw && t.text == 'alias'
- add_offence(:convention, t.pos.lineno, ERROR_MESSAGE)
- end
+ each_keyword('alias', tokens) do |t|
+ add_offence(:convention, t.pos.lineno, ERROR_MESSAGE)
end
end
end
end
end