Intro to Reading Ruby Doc: What's M, C, ::, # ?
This page is a guide to reading Ruby's official doc, for Ruby beginners.
Ruby Doc home page is at http://ruby-doc.org/
On top, you can see {Core, Std-lib, Gems}. These are most important.
- Core = Ruby language core stuff.
- Std-lib = Ruby standard library stuff.
- Gems = Third-party libraries.
For beginner, you'd be concerned with the Core and Std-lib.
Now, look at the Ruby Core doc page: http://ruby-doc.org/core-1.9.3/. The left side are classes. The right side are methods.
On the left side, the classes, some have a gray “C” some have “M”.
- C = Class.
- M = Mixin. (a mixin is similar to Java's abstract class. It's to be inherited by other class, but not meant for instantiation.)
This means, for beginner, you can probably ignore all those M ones.
On the right side, are methods, with ::
or #
.
::
→ class method. (Class Methods are those you can call without having a object. e.g. the “new” inArray.new(10)
is a class method.)#
→ instance method. (Instance Methods requires a object. e.g. the “first” in[3,4,5].first
is a instance method.)