Introduction to Ruby

What is Ruby?

Ruby is a pure object oriented, general purpose,interpreted and server side scripting and programming language. It was created in 1993 by Yukihiro Matsumoto of Japan. Ruby was built for making programmer's work easy. Ruby has a lot of built-in function which are common in mostly all projects.

Why Ruby?

As I have told earlier that ruby has a number of features:

  1. Easy syntax
  2. Full object oriented
  3. Faster than PHP and Pthon ( slower than C, C++ and Java).
  4. Ruby on rails is most leading framework for web development.

If you are new with programming then don't worried about features discussed below. We will read them in these tutorials:

  1. Every function returns something.
  2. Classes are never closed and you can reopen them.
  3. Gems of ruby provide make it more featured.

Ruby is more than this but at this basic stage we can not discus them.

Prerequisites:

  1. Ruby installed
  2. One IDE installed

Install ruby:

On windows, installing softwares is easy. Install Ruby Installer and feel cool.

Linux and mac have already ruby installed. Use ruby -v command to check version. If you found that there is no ruby installed or want to install latest version of ruby then use these commands. Note I have ruby 2.2.2 installed. You may have new version. For latest version just check Ruby Site.

On Linux:

  1. sudo apt-get update
  2. sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
  3. cd
  4. git clone git://github.com/sstephenson/rbenv.git .rbenv
  5. echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
  6. echo 'eval "$(rbenv init -)"' >> ~/.bashrc
  7. exec $SHELL
  8. git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
  9. echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
  10. exec $SHELL
  11. git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
  12. rbenv install 2.2.2
  13. rbenv global 2.2.2
  14. ruby -v

On mac:

  1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. brew install rbenv ruby-build
  3. # Add rbenv to bash so that it loads every time you open a terminal
  4. echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
  5. source ~/.bash_profile
  6. # Install Ruby
  7. rbenv install 2.2.2
  8. rbenv global 2.2.2
  9. ruby -v

Install IDE:

For all systems, I recommend Aptana Studio. It is free and featured.

Don't forget to Subscribe for getting latest Tutorials directly in your inbox.
[000webhost_bottom_banner]



About Harish Kumar

Harish is an interested person in the field of web development and blogging. He works for the need of young web developers in learning various languages, latest technologies and other essential tips and tricks. If you need some help or you have some suggestion then you email him at harish@findalltogether.com without any hesitation. You can also suggest/demand for articles of your own choice.

Related Articles

Ruby is a pure object oriented, general purpose,interpreted and server side scripting and programming language. Ruby ...
Introduction to Ruby
In this step by step free tutorials we will learn about printing, comments, puts, print, begin, end and EOF methods f...
Getting Started with Ruby
In this tutorial of free step by step free tutorials series we read about variables, constant, printing in staring an...
Variables in Ruby

Login or Sign up to leave comment.