Support Forums

Full Version: Getting Started With Ruby
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ruby
A Programmer's Best Friend.


Firstly; What Is Ruby?


Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto. It was influenced primarily by Perl, Smalltalk, Eiffel, and Lisp.

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

It appeared in 1995 and was designed by Yukihiro Matsumoto.

Ruby is also cross-platform. This means you can run it on any OS.

How Can I Get Started?


You will need to download Ruby before you do anything. You can download it here: Ruby

Next you will need to know how to run Ruby files.

Ruby file extension are usually; .rb & .rbw

After you have installed Ruby and create a test file you will need to into cmd or console and navigate to the folder that you saved the file. For example:

[Image: Untitled.png]

After you enter the file you want to run and press enter.

Try it for yourself!


Open up your favorite text editor, the one I am using is Notepad++.

Enter the following;

Code:
puts 'Hello, World!'

Then save it as hello.rb and run it! Now that wasn't so hard, compared to C++, that is a lot less code.

Code:
// THIS IS C++ NOT RUBY.
#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}

Isn't there an easier way to test Ruby Statements?



Alternatively you can use Interactive Ruby.

Ruby comes with a program that will show the results of any Ruby statements you feed it. Playing with Ruby code in interactive sessions like this is a terrific way to learn the language.

Open up IRB (which stands for Interactive Ruby).

If you’re using Mac OS X open up Terminal and type irb, then hit enter.
If you’re using Linux, open up a shell and type irb and hit enter.
If you’re using Windows, open fxri from the Ruby section of your Start Menu.

[Image: Untitl6ed.png]

Enter your statement: puts 'Hello, SF!' press ENTER and and it does the rest for you.

Note: I used ' instead of " but you can use whichever you want.
[Image: Untitl6ed.png]

Now What?


Now you learn Ruby!

Resources!

RubyLearning

IDE's:
Aptana
RubyMine
TextMate
NetBeans - My Favorite
Komodo IDE


Offical Site!
Ruby Blog
rubycorner Blog
Ruby Inside Blog



If you need any help; PM me or post here!
This is some good information, thank you for sharing.
I was hired to write a simple 2d game, no matter how..lol... (his words)...
Now I'm looking into ruby, python and jQuery, Ruby is the language I'll most probably use for it...
good resource, makes me want to look into ruby
Good share mate. Thanks for the info.
I think Im going to have to check this language out some time.
If you wanna learn Ruby on Rails I also suggest this website: http://railsforzombies.org/

Nice thread though! I still suck at Ruby but I'm trying to learn.
Great share. Will have a look at this in depth later. The guy you mentioned: 'Yukihiro "Matz" Matsumoto' Im sure he's the original inventor of the playstation :O
Very helpful tutorial! I'll bookmark this to when i'll get some times to learn ruby. :-)