class Rubocop::Cop::Style::Alias
The purpose of the this cop is advise the use of alias_method over the alias keyword whenever possible.
Constants
- MSG
Public Instance Methods
on_alias(node)
click to toggle source
TODO make this check context aware - alias_method is not available outside of classes/modules.
Calls superclass method
# File lib/rubocop/cop/style/alias.rb, line 13 def on_alias(node) # alias_method can't be used with global variables new, old = *node return if new.type == :gvar && old.type == :gvar add_offence(:convention, node.loc.keyword, MSG) super end