By arikthered via coderoshi.blogspot.com Published: Sep 02 2007 / 17:43
Very clever - avoiding initializers by defining new methods on nil. I might even suggest the following additions: def nil.push(o); [o]; end def nil.<<(o); o; end
Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.
Comments
Jim Wilson replied ago:
Very clever - avoiding initializers by defining new methods on nil.
I might even suggest the following additions:
def nil.push(o); [o]; end
def nil.<<(o); o; end
Voters For This Link (12)
Voters Against This Link (0)