addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditemptyheartfacebookfolderfullheartglobegmailgoogleimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartrashtriangle-downtriangle-uptwitteruseryahoo

Procs, Lambdas, Closures and 24 Random Ruby Tricks


6:45 - 7:00: Network with developers

7:00 - 7:10: Developers Wanted / Available

7:15 - 8:15: Featured Presentation 

Ruby Trick Shots: 24 Ruby Language Tips and Tricks   


An Introduction to Procs, Lambdas and Closures in Ruby

by Peter Cooper

We will watch two screencasts by Peter Cooper. The format for this session will be a fish bowl - an open, free-wheeling discussion where all participants are encouraged to join in and be part of the discussion. This session will be facilitated by Dan Bikle.

Join or login to comment.

  • Andy N.

    What about this: (hope it formats correctly -- just in case I'll end lines with semicolons)

    Users.all.each( { |u|
    u.do_some_stuff ;
    u.do_more_stuff ;
    return if cant_do_further_stuff ;
    u.do_further_stuff ;
    u.do_yet_more_stuff ;

    ...Wait, actually I can't remember if this'll stop work on the current user or on all of them! But either way it could be useful; just need to be clear which it is.

    March 23, 2012

  • Andy S.

    I have the same question as Dave Eisen. The fact that a return in a proc causes a return from the scope where the proc was originally defined seems like quite a surprise. Why might that be the behavior of 'least surprise'? And to Dave's point, is it useful somewhere?

    March 23, 2012

  • Dave E.

    Blocks are clearly useful. A language-supported way of managing iterators plus other good stuff.

    Lambdas too. Capturing scope with a block of code is not something I do every day --- functional programming is not my life --- but the utility is clear.

    But the proc thing. A return statement transfers control to the definition point of the proc and returns from there. Why is this useful behavior? When would this be the best way to do something?

    March 23, 2012

  • Bala P.

    I enjoyed listening to the experiences of other developers.

    March 22, 2012

  • Bala P.

    Andrew, yes. Craig you can watch it here:

    The value is in having a discussion and learn from other developers to understand the concepts.

    March 22, 2012

  • Bala P.

    Loren, that's fine. Kausi, I can drop you home but I am recovering from flu and I don't want to spread it to others.

    March 22, 2012

  • Andy N.

    Fine by me! More than fine, in fact -- we should all consider stuff like this to be normal, plus your son gets an additional insight into what Daddy does for a living.

    March 22, 2012

  • A former member
    A former member

    Does anyone mind if I bring my 8yo son to watch a movie on a laptop in a corner with headphones during the meet-up? He's pretty good about things like that and it'll make or break me being able to join or not. Of course if he's needing attention I'd leave the meeting early. Cheers, Loren

    March 22, 2012

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy