Tutorial Ruby with Shoes

No replies
Crux3r
Offline
Neophyte
Joined: 2010/11/19

I'm writing this tutorial, and also to show how 'interactive' use of Ruby. Simply because we can create several simple software, but with the advancement of each poderam things flow and then you can develop several applications. Not to mention that it's not just this course you will learn all about Ruby, I'm just going to necessarily matter in a simplified form and it behooves you to look harder and ask when you feel doubt, you are charged to the effort to advance the language.

First of all I want you to know a new friend who helped us develop our applications it is called Shoes. is an application developed by a master in that Ruby was created precisely so that we can develop so fast and simple visual applications.

How to install the Shoes?
It is simple first you will download in the site: http://shoes.heroku.com/
It has versions for Mac OS X, Linux, Windows.
Once downloaded run the installer, or open it in a shell if it is on Linux with. Run, (you can get more information on the Site.)

After that you open a text editor, and write to get the joke:

Shoes.app of
for "In Ruby, anything can be possible"
end

Save as Welcome.rb on your desktop then open the app and look for shoes, double clicks and opens the window with the text

"In Ruby, everything can be possible"

This is just the beginning boys.

Let's start using this kind of beginning to develop some things lecais!

Shoes.app {button ("Click here") {alert ("haha, this is getting cool?")}}

This code should run just as was the earlier.

We started our "Shoes.app" put a Button (Button) then pop up a specialist who is an alert.
Pretty simple is not it?

Let there is some information regarding this syntax 'different' for developing applications.

SHOES.

as you already have the basics of Ruby in the head will not be so hard, so I will not explain things, I will just present the code and then you go is good training at home.

Let's do something basic, and worked with Strings:

alert ("Yes, we can change the world")

This is a simple alert, you know well.

The next:

name = ask ("enter your name e gata:)

This now opens a window asking the question and a field for entering the name.
It seems to function 'gets' in pure Ruby.

Ah, this still too weak?

if confirm ("Go pick a color?")
backcolor = ask_color ("Pick a background)
  Shoes.app of
  background backcolor
end
end

We now have a true or false, then we open a aopção esclher of a color, and if you noticed the color you chose after you press the 'ok' becomes the background of the window.
Apart from that, you can create any things, just take one investigated.

Okay, for you it is not worth anything ta ..

RUBY SHOES WITH IN WEB.

shoes.app of
 stack of
  title "Searching Google",: size => 16
@ Status = for "Wait a minute ..."

# Search on google for 'Nemesiz' and play the HTTP headers on the screen
download <a href="http://www.google.com/search?q=nemesiz" title="http://www.google.com/search?q=nemesiz">http://www.google.com/search?q=nemesiz</a> "do | goog |
 Status.text @ = "headers" goog.responde.headers.inspect
  end
 end
end

From then on you can investigate and understand more how is the Ruby is used with other tools or in a different way.

I'm from Brazil and my English is a shi*, because it I hope you undertand the my wrongs in english .
By : f0nt_Drk