Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Module#public

public → nil
public(method_name) → method_name
public(method_name, method_name, ...) → array
public(array) → array

With no arguments, sets the default visibility for subsequently defined methods to public. With arguments, sets the named methods to have public visibility. String arguments are converted to symbols. An Array of Symbols and/or Strings is also accepted. If a single argument is passed, it is returned. If no argument is passed, nil is returned. If multiple arguments are passed, the arguments are returned as an array.

Ruby version changes

  1. 3.0