lib/rubocop/cop/alias.rb in rubocop-0.7.2 vs lib/rubocop/cop/alias.rb in rubocop-0.8.0
- old
+ new
@@ -1,15 +1,17 @@
# encoding: utf-8
module Rubocop
module Cop
class Alias < Cop
- ERROR_MESSAGE = 'Use alias_method instead of alias.'
+ MSG = 'Use alias_method instead of alias.'
- def inspect(file, source, tokens, sexp)
- each_keyword('alias', tokens) do |t|
- add_offence(:convention, t.pos.lineno, ERROR_MESSAGE)
- end
+ def on_alias(node)
+ add_offence(:convention,
+ node.loc.keyword.line,
+ MSG)
+
+ super
end
end
end
end