In Files

  • rdoc/ri/ri_util.rb



Class/Module Index [+]



Break argument into its constituent class or module names, an optional method type, and a method name



true and false have the obvious meaning. nil means we don’t care


Public Class Methods

new(arg) click to toggle source

arg may be

  1. a class or module name (optionally qualified with other class or module names (Kernel, File::Stat etc)

  2. a method name

  3. a method name qualified by a optionally fully qualified class or module name

We’re fairly casual about delimiters: folks can say Kernel::puts, Kernel.puts, or Kernel#puts for example. There’s one exception: if you say IO::read, we look for a class method, but if you say, we look for an instance method

               # File rdoc/ri/ri_util.rb, line 28
def initialize(arg)
  @class_names = []
  separator = nil

  tokens = arg.split(/(\.|::|#)/)

  # Skip leading '::', '#' or '.', but remember it might
  # be a method name qualifier
  separator = tokens.shift if tokens[0] =~ /^(\.|::|#)/

  # Skip leading '::', but remember we potentially have an inst

  # leading stuff must be class names
  while tokens[0] =~ /^[A-Z]/
    @class_names << tokens.shift
    unless tokens.empty?
      separator = tokens.shift
      break unless separator == "::"
  # Now must have a single token, the method name, or an empty
  # array
  unless tokens.empty?
    @method_name = tokens.shift
    # We may now have a trailing !, ?, or = to roll into
    # the method name
    if !tokens.empty? && tokens[0] =~ /^[!?=]$/
      @method_name << tokens.shift

    if @method_name =~ /::|\.|#/ or !tokens.empty?
      raise"Bad argument: #{arg}") 
    if separator && separator != '.'
      @is_class_method = separator == "::"

Public Instance Methods

full_class_name() click to toggle source

Return the full class name (with ‘::’ between the components) or “” if there’s no class name

               # File rdoc/ri/ri_util.rb, line 72
def full_class_name

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit