What is Ruby?
Inception
Ruby is a high-level programming language that was first publicly released in 1995 by Yukihiro "Matz" Matsumoto. Ruby was designed for programmer productivity as a priority.
Ruby Interpreter
Ruby is an interpreted language which means that instructions written in Ruby are interpreted by an interpreter without previous compiling. The original Ruby interpreter is referred to as Matz's Ruby Interpreter (MRI) and was written in C language. The current interpreter is Yet Another Ruby VM (YARV). There are alternate interpreters among which is JRuby that runs on Java Virtual Machine.
Multiple Paradigm
Ruby allows for multiple paradigm programming among which are object oriented programming, functional programming and prodedural programming.
Duck Typing
In Ruby (almost) everything is an object. An application of a particular object in Ruby is not determined by its type but rather by its capabilities i.e. existing methods and properties. In other words if we call an object a rabbit but it "walks like a duck and it quacks like a duck, then it must be a duck".
Monkey Patching
Due to its meta-programming capabilities Ruby supports Monkey Patching i.e. extending and modifying existing built-in Ruby objects (including classes) at runtime affecting only that particular program's runtime.
Ruby Gems
A Ruby package manager is called gem
and it allows for installing Ruby gems i.e. community created Ruby libraries hosted on RubyGems.org.
gem install rails
Everything Is an Expression
Many programming languages distinguish between expressions which return values and statement which do not and are primarily used for flow control (it could be said that expressions are executed and evaluated and statements are simply executed). This is not the case in Ruby. In Ruby everything is an expression which means that everything returns a value. Method calls, method definitions, variable and constant assignments, literals, loops, class definitions, if
control flow and other return a value.
Comments
One line comment:
# This is a comment puts "This is not a comment" # But this is.
Multiline comment:
=begin This is a multiline comment. =end