And I thought Ruby was crack…

Apparently it’s not crack that Ruby brings to the table. Witness:

def date=(val)
    [:year, :month, :day].each do |meth|
        raise ArgumentError unless val.responds_to?(meth)
    end
    @date = val
end

Let’s see that one line again:

   [:year, :month, :day].each do |meth|

Yes, you read it here first! Ruby, promoting meth use. The first one’s free!

From this RubyTalk post on Duck Typing.

What’s next? A method that puts out??

No Comments

  1. atmos says:

    Oh shit, that just brightened my day. :)

  2. Sean Bryant says:

    That was rather amusing.

  3. misuba says:

    Will you marry me?

  4. PragmaticBlonde says:

    Will you marry him?

  5. AhoysBoy says:

    Yes Yes, will you marry him??

  6. aqua says:

    well, i have to go with the crowd i guess…

    will you marry us?

    ok. all joking aside, im guessing this is real code from ruby library ? ;)

    have to say thats almost as good as the comments found in win2k/xp code that was leaked :-P

  7. Derek says:

    ‘puts out’ is definitely going into the code for my robot.

    -Lateralus

  8. Amy says:

    Sorry guys, AhoysBoy is the real deal — I’m spoken for ;) (Besides, marrying someone who proposed in a blog comment? Who wants to be a story on Reuter’s Oddly Enough?)

  9. Jake says:

    hilarious…

    +subscribed! :)

Hey, why not get a shiny
Freckle Time Tracking
account?