04-29-2011, 08:22 AM
Ruby
A Programmer's Best Friend.
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:
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.
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.
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!
Someone with no history is nothing but suspicious.