In Ruby we can add new methods to existing classes.
How can we ensure that the name of our new method does not already
exists -- I do not want to overwrite an existing method by accident. I
think there exists a way to list all currently existing methods of a
class, but the solution should work in future too( e.g. for Ruby 3.0
when predefined classes may have more predefined methods): I want
something like

class String
  def very_useful_method
    if already_defined(this_method)
      puts 'We are overwriting an existing method by accident'
      Process.exit
    end
  end
end

Best regards

Stefan Salewski