Ruby Overview
Ruby is a pure object oriented programming language. It was conceived on February, 1993 as a balanced functional / imperative programming language by Yukihiro "Matz" Matsumoto. "I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That's why I decided to design my own language".
Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflective. It also has a dynamic type system and automatic memory management. Combining syntax inspired by Perl with Smalltalk-like features, it is therefore similar in varying respects to Python, Eiffel, Ada, Lisp, Dylan, and CLU.
Following are the key turning points in Ruby history,
- 1993, Feb 24 - Matz starts work on Ruby
- 1993, April - First "hello world" works in Ruby
- 1994, December - Ruby first alpha version was released
- 1995, December 21 - Ruby 0.95 was announced (Japanese newsgroups only)
- 1996, December 25 - Ruby 1.0-961225 was released
- 1997, July 1 - Matz announces Netlab hired him (full-time Ruby dev.)
- 1997, August 12 - Ruby 1.1 (alpha)was released
- 1997, Septempber 22 - First article on the web about Ruby was published
- 1997, December 25 - Ruby 1.0-971225 was released
- 1998, July 17 - Ruby 1.1c0 was released
- 1998, December 17 - ruby-talk mailing list was started
- 1998, November 26 - Ruby 1.1c9 was released
- 1998, December 25 - Ruby 1.2 was released
- 1999, January 11 - Ruby 1.2.1 was released
- 1999, June 21 - Ruby 1.2.6 was released
- 1999, July 28 - Ruby 1.3.6 (beta release to 1.4) was released
- 1999, August 13 - Ruby 1.4.0 was released
- 1999, October 27 - Matz and Keiju's book is published, the first Ruby book
- 1999, December 07 - Ruby 1.4.3 was released
- 2000, May 03 - Official Ruby newsgroup started
- 2000, August 16 - Ruby 1.4.6 was released
- 2000, December 25 - Ruby 1.6.2 was released
- 2001, October 12 - RubyConf started
- 2001, December 15 - Pickaxe book on Ruby was released
- 2001, December 26 - Ruby 1.6.6 was released
- 2002, May 10 - Official Ruby-core mailing list started
- 2002, December 24 - Ruby 1.6.8 (last of the series) was released
- 2003, August 04 - Ruby 1.8.0 was released
- 2004, July 25 - Web application framework Ruby on Rails 0.5 released
- 2004, December 25 - Ruby 1.8.2 was released
- 2005, September 21 - Ruby 1.8.3 was released
- 2006, August 25 - Ruby 1.8.5 was released
- 2007, March 13 - Ruby 1.8.6 was released
- 2007, December 25 - Ruby 1.9.0 (development version) was released
- 2008, May 31 - Ruby 1.8.7 was released
- 2009, January 30 - Ruby 1.9.1 (First Production Release) was released
- 2009, July 20 - Ruby 1.9.2 (preview 1) was released
- 2009, December 07 - Ruby 1.9.1 (Latest Production Release) was released
- 2009, December 24 - Ruby 1.8.7-p248 was released
- 2010, January 10 - Ruby 1.8.6-p388; 1.8.7-p249 and 1.9.1-p378 were released
- 2010, April 02 - Ruby 1.8.6-p399 was released
- 2010, July 31 - Ruby 1.9.2-p0 is planned to be released.
- ????, Ruby 2.0 release in future
You can find the name Yukihiro Matsumoto on the Ruby mailing list at Ruby Forum
Ruby is "A Programmer's Best Friend".
Ruby Language Features:
- Ruby is open-source and freely available on the Web, but it is subject to a license.
- Ruby is a general-purpose, interpreted programming language.
- Ruby is a true object-oriented programming language.
- Ruby is a server-side scripting language when properly setup.
- Ruby can be used to write Common Gateway Interface (CGI) scripts.
- Ruby can be embeded into Hypertext Markup Language (HTML) using eRuby for instance.
- Ruby has a clean and easy syntax allowing a quick and easy learning.
- Ruby has some similar syntax to programming languages such as C++ and Perl.
- Ruby is very much scalable (see twitter.com) and programs are easily maintainable.
- Ruby can be used for developing Internet and intranet applications.
- Ruby can be installed in Windows and POSIX environments.
- Ruby support many GUI tools such as Shoes, Tcl/Tk, GTK, and OpenGL.
- Ruby can easily be connected to DB2, MySQL, Oracle, and Sybase.
- Ruby has a rich set of built-in functions which can be used directly into Ruby scripts.
How Ruby works?
Ruby is designed around Objects and the common cases of working with them:
class TalkToMe
def say
puts "Hello world!"
end
end
TalkToMe.new.say #=> "Hello world!"
# Much better then doing this:
TalkToMe.new().say()
Ruby has a wonderful command-line tool called irb (Interactive Ruby). Written by Keiju Ishitsuka, it comes along with Ruby installation out of the box.
You type Ruby commands and expressions, and irb executes them on the spot.
Within the IRb shell, you can immediately view expression results, line by line.
Just type irb at your command prompt and an Interactive Ruby Session will start as given below:
C:\>irb -v
irb 0.9.5(05/04/13)
C:\>irb
irb(main):001:0> def hello
irb(main):002:1> out = "Hello World"
irb(main):003:1> puts out
irb(main):004:1> end
=> nil
irb(main):005:0> hello
Hello World
=> nil
irb(main):006:0> exit
C:\>
A lot of what you'll see and write in Ruby programs are method calls. Method calls sometimes consist simply of the name of a method, in bareword form, possibly followed by one or more arguments to the method.
It's highly recommended that you create a separate directory for examples you copy from here. Something like this should be suitable:
C:\>cd
C:\>mkdir ruby4rails
C:\>cd ruby4rails
Type the code using any text editor (SciTE, vi, Emacs, Notepad, and so on), and save it under a filename like this: myprogram.rb in your ruby4rails directory.
Notice: Word Processors are useless into this. You really need a Plain Text Editor.
You now have a Ruby program on your disk, and you can run it with the following:
C:\>ruby myprogram.rb


