iain iain - 2 years ago 66
Ruby Question

Where are the keyword method arguments documented in ri?

I often forget the syntax for the newer keyword arguments when I want to scoop up extra arguments with double splats and the like. The online Ruby docs has articles such as http://ruby-doc.org/core-2.1.0/doc/syntax/methods_rdoc.html and http://ruby-doc.org/core-2.0.0/doc/syntax/calling_methods_rdoc.html, but how could I access this info via


Or is
(as implied by the interactive mode's question "Enter the method name you want to look up") the only sort of thing it will find?

Any help or insight will be much appreciated.

Answer Source

You can access the static pages via:

$ ri ruby:syntax/methods


= Methods

Methods implement the functionality of your program.  Here is a simple method

  def one_plus_one
    1 + 1

A method definition consists of the def keyword, a method name, the body of
the method, return value and the end keyword.  When called the method will
execute the body of the method.  This method returns 2.

This section only covers defining methods.  See also the {syntax documentation
on calling methods}[rdoc-ref:syntax/calling_methods.rdoc].

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download