Rubyize this : 5th edition

It’s been a while since the last edition of Rubyize this. I have waited all this time because I like when people become impatient. I have received 254 939 emails from desperate people asking me : “When will you post your 5th edition?”, “Is it hard to be that excellent?”, “You rock Frank. Warm kisses… – Vanessa” and such.
Hold on a second, gotta update my checklist :

  1. Invent myself a pleasing reality
  2. Impress people with fictitious numbers
  3. Write a bad intro for the 5th edition

2 days ago I received an email from Scott Patten, an active web developer based in Vancouver. He is currently helping to organize RubyCamp Vancouver 2008, which is a free one-day gathering for Rubyists and Railers. In his email, he asked me if he could use the Rubyize this concept for an (un)conference event that would be held at RubyCamp. Of course, I said yes! It now seems official : Rubyize this will be part of RubyCamp Vancouver 2008! I was also happy when I read the following : “the audience will submit their refactorings to Refactor My Code“. That’s good for you, Marc!
Important : The future of Rubyize this
I need your help to create ugly pieces of code! I don’t want to become repetitive from edition to edition so I’d really appreciate if you could send me some fresh ideas. Just send me an email to [email protected] containing an ugly piece of code as well as a small intro to help us understand what this is all about. I’ll make sure to put your name as well as a link to your website (if any) in the appropriate Rubyize This edition.
Enough babbling :
Tom wrote a very simple ruby script to highlight some words in a text. He chose to highlight the words with asterisks, like *that* (In 2 months, perhaps Tom will have to use his script to produce HTML output or something else… he will be screwed with those basic asterisks). Tom has absolutely no ruby background, help him refactor his code ala Ruby, that is : short, clean and simple.
By the way, Tom didn’t put a lot of effort in his algorithm. His dumb gsub thing will mistakenly replace parts of words instead of whole words only. Maybe some improvements would be needed there.

@wordsToHighlight=["important","monkey","dancing"]
def highlightText(input)
  for i in [email protected] do
    input = input.gsub(@wordsToHighlight[i],"*" + @wordsToHighlight[i] + "*")
  end
  return input
end

Refactor this!

20 thoughts on “Rubyize this : 5th edition

  1. wow! that’s awesome! glad to see your concept getting more and more traction and thx for promoting RmC w/ it, you’re the best.
    Can’t wait for the t-shirt “Rubyize-me Frank”, when is it shipping already?

  2. Wow, thanks all for your contributions… some pretty good stuff here! It’s always fun and instructive to watch how people solve problems in ruby.
    @Marc,
    Thanks! About the rubyize-this shirts, I’m starting to think about it seriously 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *