This StackOverflow question about nested function definitions in Ruby imparts a good understanding of Ruby's def.
def