Gray's Matter
Justice Gray - North America's favorite metrosexual software consultant
E-mail Justice
Subscribe to this feed
Subscribe to comments
Perennially Popular Posts
How to write a presentation abstract
My grandmother, globalization, and what's wrong with DateTime.Parse
A letter to my Worldvision sponsor child
Development Methodologies for the 21st Century
My grandmother & the difference between strong typing and weak typing
How I am becoming a better developer, part 1 of infinity
Facebook RSS Feeds: How to Write Your Own With C#
The Ten Keys To Happiness
My grandmother and the Global Assembly Cache (And Star Wars)
My grandmother and the difference between processes and threads
How to make a meeting request
Why you should never be an independent consultant
The DasBlog 1.9 AJAX Autosave True Story, Part 2
Other "metro" developers
Ben Scheirman
Bil Simser
D'Arcy Lussier
David Woods
Donald Belcham
Donald Jessop
George Clingerman
James Kovacs
Jason Hunt
Jason Row
Jean-Paul Boodhoo
Jeffrey Palermo
Joey deVilla
John Bristowe
Jonas Avellana
Kyle Baley
Mack Male
Martin Hinselwood
Michael McClenaghan
Mike Duncan
Mike Friesen
Mo Khan
Otyce
RoboSapient
Russell Ball
Scott Hanselman
Scott Reynolds
Steven Rockarts
Tech Embassy
Terry Thibodeau
Tom Opgenorth
Vladimir Levin
The Justice Gray Fan Club
Amazing Mrs. Loquacious
Dr. Teeth
Facedown
Janey Lynne
Maxime Lamy
Ridley Thunder
Stan Woo
Vanilla Con
Wobbly*Bits
I Wish These People Updated More Than Once a Year
Anand Narayan
Jeff Perrin
<< Gowan and how I became the David Hasselhoff of Hong Kong
Contractor vs. employee: the *real* benefit >>
Ruby 101: Classes and *more*!
With a new day dawns another
5 minutes of Ruby tutorials
! Today's silent screencast covers the following:
Classes in Ruby
Property getters, setters, constructors, inheritance, you name it! We go over it in a simple example using
Donald
, Justice, the
EDMUG
executive and the all-important "hair" property.
Some supplements here:
super
indicates a call to the parent class
<
indicates an inheritance: e.g. "
Donald < EdmugExec
" means Donald inherits from EdmugExec
@variable_name
indicates an instance variable of a class
Easy reflection in Ruby
Take a look at how quickly we can receive class information in Ruby! Just ask and it is given.
Hooks
The simulation of the EDMUG executive continues! Art imitates life as Donald finds there are just some things he can't do, so he gets Justice to do them for him...in this case, using the
method_missing
hook to delegate failed requests to a different object! (This will tie in later to an interesting decorator implementation - stay tuned!)
A note here: you'll notice that method_missing is implemented using the following syntax:
def method_missing(method, *args, &block)
The * behind an argument in Ruby means that there are a variable number of arguments. The & prior to an argument in Ruby converts a block (if there is one) into a Proc object.
You can modify anything in Ruby
What happens if we want to add the infamous
swinging lightsaber method
to the Donald class at run-time? What if we just want to add it to one *instance* of the Donald class? Anything is possible!!
You can modify anything in Ruby, so let's not get retarded
I don't think this needs any further explanation ;)
If you somehow missed the link above,
download installment 4 right here
!
Wednesday, October 18, 2006
Comments [3]
Ruby
|
Technical
|
Tracked by:
"Ruby 101: Adding functionality with decorators and mixins" (Gray's Matter)
[Trackback]
"Ruby 101: with special guest star WILLIAM SHATNER" (Gray's Matter)
[Trackback]
10/20/2006 6:12:34 PM (Mountain Daylight Time, UTC-06:00)
Looks like John Lam is going to work at Microsoft:
http://www.iunknown.com/articles/2006/10/20/dynamic-languages-microsoft-and-me
Tom Opgenorth
|
tomAT NOSPAMopgenorth dot net
11/2/2006 5:17:26 PM (Mountain Daylight Time, UTC-06:00)
Jesus fucking christ buddy! You make it sound like Ruby is _new_ technology - never been done before anywhere. What kind of software consultant are you? C#? Oh... Well that explains a lot.
Guru
|
guruAT NOSPAMdotnet dot net
11/2/2006 5:21:30 PM (Mountain Daylight Time, UTC-06:00)
Hey guru!!
Ruby is definitely not anything new - as I was saying in an earlier post it's actually been around since 1995. It's only taken off with the advent of Rails.
I know it sounds like I'm totally taking the kid gloves in this series, but there are actually still a lot of .NET devs who are not only totally unfamiliar with Ruby but unfamiliar with dynamic languages as a concept. It's mostly designed as some intro level stuff (all of the pieces of this are part of my "Intro to Ruby" presentation).
Thanks for the feedback! So are you more into Ruby or .NET in general?
Justice
Name
E-mail
Home page
Remember Me
Comment (HTML not allowed)
Enter the code shown (prevents robots):
Justice Gray
: a seething cauldron of rampaging masculinity. A fighter! A brother! Your
secret lover
! He's also a software development consultant and the Vice President of the
Edmonton .NET user group
. He also greatly enjoys speaking about himself in the 3rd person.
Gray's Matter Archives
Recent Posts
Foreshadowing is over
Foreshadowing, part II
Foreshadowing
Controversy clarifications!
The most controversial interview of ALL TIME
Finally! The *winner* of the "What Justice Gray Means to Me" contest
The mystery of D'Arcy Lussier's ASP.NET MVP is solved...
Well, now that's pretty horrifying
MVPs on MVC: "No, we don't have any idea either"
Why I am happy to not be at the MVP Summit
Donald Belcham's cry for help: MS MVPs, your attention is needed
Post Categories
BookReviews
Conferences
DasBlog
EDMUG
Goals
HanselmanQuestions
HotDeveloperCorner
ILiveToInform
Leadership
Mac
OtherGrayAreas
Personal
Productivity
Ruby
Suresh
Technical
Transformers
Vancouver
Wii
<
August 2008
>
Sun
Mon
Tue
Wed
Thu
Fri
Sat
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
Sign In