Ruby is a multi-platform, open-source, dynamic, object-oriented, interpreted language created by Yukihiro Matsumoto (Matz) in 1993.

Ruby is an open-source, dynamic, object-oriented, interpreted language that combines the good bits from Perl, Smalltalk, and Lisp. Its primary purpose is to "help every programmer in the world to be productive, and to enjoy programming, and to be happy." Ruby focuses on simplicity and productivity.

Ruby was initially conceived on February 24, 1993 by Yukihiro Matsumoto ('Matz'), and version 1.0 was released in 1996. The current stable version is 2.2.2.

Ruby's mindshare spiked around 2005 due to Ruby on Rails, an MVC (Model, View, Controller) framework for building web applications, and usage continues to grow as of 2013 with Ruby continuing to find acceptance in the commercial marketplace.

Ruby supports multiple programming paradigms, including functional, object oriented and imperative. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Smalltalk, Python, Perl, Lisp, Dylan, and CLU.

You can download the Ruby source code from or from GitHub.

Naming Conventions1

Ruby Names are used to refer to constants, variables, methods, classes, and modules. The first character of a name helps Ruby to distinguish its intended use. Certain names are reserved words and should not be used as variable, method, class, or module name. Lowercase letter means the characters "a" through "z". Uppercase letter means "A" through "Z", and digit means "0" through "9". A name is an uppercase letter, lowercase letter, or an underscore ("_"), followed by Name characters (this is any combination of upper- and lowercase letters, underscore and digits).


Variables in Ruby can contain data of any type. You can use variables in your Ruby programs without any declarations. Variable name itself denotes its scope (local, global, instance, etc.).

  • A local variable (declared within an object) name consists of a lowercase letter (or an underscore) followed by name characters (sunil, _z, hit_and_run).
  • An instance variable (declared within an object always "belongs to" whatever object self refers to) name starts with an "at" sign (@) followed by a name (@sign, @_, @Counter).
  • A class variable (declared within a class) name starts with two "at" signs (@@) followed by a name (@@sign, @@_, @@Counter). A class variable is shared among all objects of a class. Only one copy of a particular class variable exists for a given class. Class variables used at the top level are defined in Object and behave like global variables. Class variables are rarely used in Ruby programs.
  • Global variables start with a dollar sign ($) followed by name characters. A global variable name can be formed using $- followed by any single character ($counter, $COUNTER, $-x). Ruby defines a number of global variables that include other punctuation characters, such as $_ and $-K.


A constant name starts with an uppercase letter followed by name characters. Class names and module names are constants, and follow the constant naming conventions. Examples: module MyMath, PI=3.1416, class MyPune.

Method Names

Method names should begin with a lowercase letter (or an underscore). ?, ! and = are the only weird characters allowed as method name suffixes (! or bang labels a method as dangerous - specifically, as the dangerous equivalent of a method with the same name but without the bang)

Knowledge Base:

Code Language (used for syntax highlighting): lang-rb