Fun with Ruby

posted @ Friday, December 16, 2005 4:32 PM

 

Some of you may know that I like to play around with other programming languages, one of those being Ruby. I came across a t-shirt the other day and thought it was pretty funny. I modified it just a tad so you can run it from the console. Here it is:


class Programmer
def initialize(language)
@language
= language
end
def happy?
@language
=~ /ruby/ ? true : false
end
def make_happy!
puts @language
= 'Ruby'
end
end
you
= Programmer.new(gets)
unless you.happy?
you.make_happy!
end