coding art

Posted by joe.sixpack on November 18, 2006

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 = IO.read('TODO')
  # hand made TODO api here
end
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
   end
end
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.

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. mono Mon, 20 Nov 2006 06:57:08 UTC

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

  2. joe.sixpack Mon, 20 Nov 2006 10:56:06 UTC
Comments