List of Ruby Class Aliases
A random class method is Random.rand
aliased as rand
(i.e. equivalent to Random.rand
). Is there anyway to get a list of the class aliases used by Ruby?
Not sure if the Ruby documentation offers a complete list as it identifies rand
as an alias Random.rand
, but there is no mention of what srand
an alias is, but it can be invoked with srand
orRandom.srand
I ended up answering my own question - please see below.
source to share
Edit my original question:
This question had its root in a misunderstanding of the link to the Ruby Random class documentation http://ruby-doc.org/core-2.0/Random.html , which refers to the rand alias for Random. method of class rand. It turns out that rand and srand both refer to methods of the Kernel instance. To call the methods of the class Random, rand and srand class, you need to provide a full allowed call, eg. Random.rand or Random.srand
So the list I was looking for is actually the documentation of the kernel of the Kernel instance methods http://www.ruby-doc.org/core-1.9.3/Kernel.html
source to share