class RuboCop::Cop::Style::StringMethods
from the String class.
This cop enforces the use of consistent method names
def autocorrect(node)
def autocorrect(node) lambda do |corrector| corrector.replace(node.loc.selector, preferred_method(node.loc.selector.source)) end end
def on_send(node)
def on_send(node) _receiver, method_name, *_args = *node return unless preferred_methods[method_name] add_offense(node, :selector, format(MSG, preferred_method(method_name), method_name)) end