class RuboCop::Cop::Performance::Caller

def on_send(node)

def on_send(node)
  return unless caller_with_scope_method?(node)
  method_name = node.receiver.method_name
  caller_arg = node.receiver.first_argument
  n = caller_arg ? int_value(caller_arg) : 1
  if node.method?(:[])
    m = int_value(node.first_argument)
    n += m
  end
  preferred_method = "#{method_name}(#{n}..#{n}).first"
  message = format(MSG, preferred_method: preferred_method, current_method: node.source)
  add_offense(node, message: message) do |corrector|
    corrector.replace(node, preferred_method)
  end
end