coding art

this code is a piece of art. It was the most inspiring use of ruby i’ve seen in a while. First there is:

class << TODOS ='TODO')
  # hand made TODO api here

which wraps the String just loaded from disk in its very own, perfectly suited API. This is like hand made english cut vs. H&M. And than there is:

items.grep(regexp).instance_eval do
   def display
     # custom display function here

which again, does nicely fit a custom API around the found data. Doing it on the fly, no base classes, interfaces or and other sign of bothering the user with extraneous code. I just love it.


  1. mono · November 20, 2006

    Wirklich schön, nur dass dein Code-Zitat völlig aus dem Zusammenhang gerissen ist. Ohne Klicken nicht nachvollziehbar.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s