The Elf With a Pet Ham

Finally! Someone got to writing technical documentation that does not need to be broken up with porn and pictures of beetles to make it fun to read. I'm learning Ruby - on Rails - and compared to the usual slew of boring white books, this is just plain awesome: Why's (poignant) Guide to Ruby (with cartoon foxes). An excerpt:


Animal Perfect is now the future of animal enhancement. They build new animals and salvage old-style animals for parts. Of course, they’ve come a long ways. When Animal Perfect started, you’d see a full-grown bear walk into Animal Perfect and you’d see a full-grown bear with sunglasses walk out. Completely cheesy.

Stick around and you’ll see a crab with his own jet pack. That’s a new 2004 model jetcrab.

But now, the whole operation is up and running. And the cleanliness of the place is astonishing. All the equipment is so shiny. Everything is in chrome. Oh, and all the staff have concealed weapons. They’re trained to kill anyone who enters unannounced. Or, if they run out of bullets, they’re trained to pistol whip anyone who enters unannounced.

'Elf, make me a starmonkey.'

First, the star is caught.
the

Some imaginary Ruby for you:

pipe.catch_a_star

Variable pipe. Method catch_a_star. A lot of Rubyists like to think of methods as a message. Whatever comes before the dot is handed the message. The above code tells the pipe to catch_a_star.

This is the second half of Ruby. Putting things in motion. These things you define and create in the first half start to act in the second half.

1. Defining things.
2. Putting those things into action.

So what if the star catching code works? Where does the star go?

captive_star = pipe.catch_a_star

See, it’s up to you to collect the miserable, little star. If you don’t, it’ll simply vanish. Whenever you use a method, you’ll always be given something back. You can ignore it or use it.

If you can learn to use the answers that methods give you back, then you will dominate.

the

Quickly then.

starmonkey = ratchet.attach( captive_monkey, captive_star )

The ratchet gets an attach message. What needs to be attached? The method arguments: the captive_monkey and the captive_star. We are given back a starmonkey, which we have decided to hang on to.

the

This is turning out to be such a short, little proggie that I’m just going to put it all together as one statement.

starmonkey = ratchet.attach( captive_monkey, pipe.catch_a_star ) + deco_hand_frog

See how pipe.catch_a_star is right in the arguments for the method? The caught star will get passed right to the ratchet. No need to find a place to put it. Just let it go.


Link: Why's (poignant) Guide to Ruby (with cartoon foxes) it's Creative Commons Licenced :-)
Also: AJAX on rails

Created 2007-01-30 15:40:28 by 357 and filed under stuff

Comments

lzlucdb writes...

xWw1Sf auswahhuvevc, [url=http://hftlgfbhmbss.com/]hftlgfbhmbss[/url], [link=http://tdjxadmbggns.com/]tdjxadmbggns[/link], http://wofmlcyhionw.com/

posted: 2011-03-9 21:29:37


Add Comment

Name

Email (will not be published)

Website (optional)

Comment

if you are visually challenged please send comments by email
(Please retype the captcha.)



Subscribe to this blog by RSS.



Toys

Ransom Notes
Stencil Maker
Mix Poetry
Sarcasmotron
Shocked Robin
Jailbaiting
Google Adult
Yahoo Adult
Context Free
Google Video
myCFDG3d
Hotlink Lottery

Categories


hacking
internet
introspection
music
photography
stuff
stupid
things
webcomic

Recent Posts

Calling all Junior Scientists
Golf GTI Scale-Electric Flash Game
Obama Cuts Funding For Abstinence Only Sex Ed
Pictures from the Moscow Gas Pipeline Fire
Sea Monster in the English Channel
Give Him Bacon
The Moar You Know
A Song to Ride Ducks By
New York Became My Canvas
How I Wonder Is A Cat

Popular Posts

The BBC iPlayer
Christian Nudist Camp
Hacking iFriends
iFriends GreaseMonkey Script
A Higher Art, Nude Ballet
BBC Documentaries as Torrents
Hacking Dating Websites
HOWTO Make A Stencil
Assvertising
Golf GTI Scale-Electric Flash Game

Galleries

Webcomic
ContextFree
SarcasmoTron
Drawings
Wallpaper
Interesting Maps
Ransom Notes
Photographs 2007
Photographs 2006
Nuts and Chickens
Made With Machines

Webcams

 [See the world >>]
80.160.169.182 - Axis 195.136.36.165 - Axis 137.229.91.47 - Axis 198.189.234.13 - Axis 212.211.133.190 - Axis 209.251.37.226 - Axis
CC Developing Nations
  Support Bloggers` Rights!
Developing Nations Licence.
dumbbuthappy at gmail dot com

- (Made By Machines) -