Sinisterly
Getting Started With Ruby - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: Getting Started With Ruby (/Thread-Getting-Started-With-Ruby)



Getting Started With Ruby - Exkr - 08-29-2015

Ruby
A PROGRAMMER'S BEST FRIEND


Firstly; What Is Ruby?


Ruby is...
A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. (https://www.ruby-lang.org/en/) 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 is also cross-platform meaning it can run on any OS that has the runtime installed. You can download Ruby here: https://www.ruby-lang.org/en/downloads/ - The current stable version is 2.2.3 at the time of this post.

Ways of Installing Ruby
  • On Linux/UNIX, you can use the package management system of your distribution or third-party tools (rbenv and RVM).
  • On OS X machines, you can use third-party tools (rbenv and RVM).
  • On Windows machines, you can use RubyInstaller.

How Can I Get Started?


Firstly, you will need to download Ruby on your system before you can start developing. Alternatively you can use an online IDE to run your programs.

Ruby file extensions are usually; .rb, .rbw. If you are using a text editor to write your scripts then you will need to save the file under one of these extensions. Once you have installed Ruby on your system you can start by entering "irb" into your terminal.

[Image: VN52ykv.png]

The interactive terminal help your test your Ruby code on the fly, you simply type what you want and the IRB will execute the code for you. For example you can do quick maths (1+ 4, 4 * 5, 3 / 4) you can add variables and arrays (new_array = [1, 2, 3]) and so on.

[Image: Szno9ha.png]

Try It For Yourself!


Okay, now that you know how to install it and run irb, it's time to create a script using a text editor or an IDE whichever one you prefer.

Open up your favourite text editor or, the one I am using is RubyMine.

Enter the following;

Code:
puts 'Hello, World!'

Then save it as hello.rb and run it! Your Ruby files will all have the .rb file extension. To run the hello.rb Ruby script, run the command ruby hello.rb 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; }

Learning Ruby & Resources


Learning Ruby:

Ruby | Codecademy
Try Ruby: learn the basics
Learn Code The Hard Way
Ruby in Twenty Minutes

IDE's:

Aptana
RubyMine


RE: Getting Started With Ruby - null - 08-29-2015

I love ruby.

IDEs for it are a bit pointless though.


RE: Getting Started With Ruby - Exkr - 08-29-2015

(08-29-2015, 12:16 PM)null Wrote: I love ruby.

IDEs for it are a bit pointless though.

Ruby is my favourite scripting language.

I prefer using IDE's, especially on larger project with Rails, it's also faster to execute scripts with just one bottom rather than running through the terminal. Less windows the better, at least for me it is.


RE: Getting Started With Ruby - null - 08-29-2015

(08-29-2015, 12:18 PM)Jare Wrote: Ruby is my favourite scripting language.

I prefer using IDE's, especially on larger project with Rails, it's also faster to execute scripts with just one bottom rather than running through the terminal. Less windows the better, at least for me it is.

Fair enough. I've never worked with rails or anything. Not really made any massive projects either. I am one of those losers who insists on using vim for everything.


RE: Getting Started With Ruby - phyrrus9 - 08-29-2015

Alright, props for getting down and writing something, it's been lacking lately.

ON THE OTHER HAND,

All you did was show someone how to install Ruby and write a hello world program. Nobody can learn a language well by seeing completed programs, they need to work on their own. You should write a tutorial that explains the mechanisms and syntax of Ruby for those who still don't know it.


RE: Getting Started With Ruby - Exkr - 08-29-2015

(08-29-2015, 06:04 PM)phyrrus9 Wrote: Alright, props for getting down and writing something, it's been lacking lately.

ON THE OTHER HAND,

All you did was show someone how to install Ruby and write a hello world program. Nobody can learn a language well by seeing completed programs, they need to work on their own. You should write a tutorial that explains the mechanisms and syntax of Ruby for those who still don't know it.

While this is basic it's not the basic fundamentals of programming. It is simply instructing users on how to get started with Ruby. I will write another tutorial on Ruby and its syntax.


RE: Getting Started With Ruby - Inori - 08-29-2015

1. Fuck yeah, Ruby!
2. I wrote a few tutorials a while back when I was bored in class, might want to check those out (or maybe link them? :3)
3. Sublime Text is an awesome Ruby editor. I highly recommend it.


RE: Getting Started With Ruby - Exkr - 08-29-2015

(08-29-2015, 07:51 PM)Chitoge Wrote: 1. Fuck yeah, Ruby!
2. I wrote a few tutorials a while back when I was bored in class, might want to check those out (or maybe link them? :3)
3. Sublime Text is an awesome Ruby editor. I highly recommend it.

You can link them and I will add them to the thread!