Method: RuboCop::Cop::HashTransformMethod::Autocorrection#set_new_method_name

Defined in:
lib/rubocop/cop/mixin/hash_transform_method.rb

#set_new_method_name(new_method_name, corrector) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/rubocop/cop/mixin/hash_transform_method.rb', line 62

def set_new_method_name(new_method_name, corrector)
  range = block_node.send_node.loc.selector
  if (send_end = block_node.send_node.loc.end)
    # If there are arguments (only true in the `each_with_object`
    # case)
    range = range.begin.join(send_end)
  end
  corrector.replace(range, new_method_name)
end