class RuboCop::Cop::Style::PreferredHashMethods

Hash#has_value?
Hash#has_key?
# good
Hash#value?
Hash#key?
# bad
@example EnforcedStyle: verbose
Hash#value?
Hash#key?
# good
Hash#has_value?
Hash#has_key?
# bad
@example EnforcedStyle: short (default)
is a ‘Hash` or responds to the replacement methods.
This cop is unsafe because it cannot be guaranteed that the receiver
@safety
`EnforcedStyle: verbose` configuration.
It is configurable to enforce the verbose method names, by using the
`Hash#has_value?`, and suggests using `Hash#key?` and `Hash#value?` instead.
Checks for uses of methods `Hash#has_key?` and

def message(method_name)

def message(method_name)
  format(MSG, prefer: proper_method_name(method_name), current: method_name)
end

def offending_selector?(method_name)

def offending_selector?(method_name)
  OFFENDING_SELECTORS[style].include?(method_name)
end

def on_send(node)

def on_send(node)
  return unless node.arguments.one? && offending_selector?(node.method_name)
  message = message(node.method_name)
  add_offense(node.loc.selector, message: message) do |corrector|
    corrector.replace(node.loc.selector, proper_method_name(node.loc.selector.source))
  end
end

def proper_method_name(method_name)

def proper_method_name(method_name)
  if style == :verbose
    "has_#{method_name}"
  else
    method_name.to_s.delete_prefix('has_')
  end
end