November 2008

November 13, 2008

6:00 - 7:30 PM


David W. Body / Big Creek Software, LLC


Blocks and Closures in Ruby

People who are new to Ruby can usually learn the basics of the language and start getting work done in just a few hours.  That's because most of Ruby's syntax and semantics are familiar to anyone who knows another object-oriented language such as Java, C#, PHP, or Delphi.

However, one of the more unique features of Ruby, and one that sometimes mystifies Ruby rookies, is the Ruby block.  What's a Ruby block?  Here's a simple example:

  5.times do
        puts "Hello, Iowa!"

The block is the code between the do and end keywords.  This could also be written as

  5.times { puts "Hello, Iowa!" }

This time the block is the code inside the {}.

David's presentation will be in three parts.

  • For Ruby beginners, David will introduce Ruby iterators and blocks, and will show how they work and how you can use them in your own programs. You'll see that it's simpler than you might first think.

  • For intermediate Rubyists, David will discuss the closely related subjects of closures, and Ruby procs and lambdas.  We'll see that procs and lambdas are essentially objects representing chunks of code that operate in the context in which they were defined.

  • Finally, for all Ruby users, David will talk about the changes in Ruby 1.9 relating to blocks, procs, lambdas, etc.

Something for everyone!

Meeting Location

Coldwell Banker / Mid-America Group Realtors
8825 Northpark Court
Johnston, Iowa

Just north of I35/80 at the 86th Street exit.

GPS coordinates: N 41° 39.368' W 93° 44.378'

Wi-fi Internet access is available.

Click here for a map.

Dinner After the Meeting

If you can, please plan to join us for dinner at a local restaurant after the meeting.