Skip to content

Instantly share code, notes, and snippets.

@mattdenner
Created September 18, 2012 14:01
Show Gist options
  • Select an option

  • Save mattdenner/3743290 to your computer and use it in GitHub Desktop.

Select an option

Save mattdenner/3743290 to your computer and use it in GitHub Desktop.
def inner(&block)
puts "BEFORE YIELD"
x = yield
puts "AFTER YIELD"
x
ensure
puts "ENSURE YIELD"
end
def call_inner_with_return
inner { return "foo" }
end
def call_inner_without_return
inner { "foo" }
end
puts call_inner_without_return
puts call_inner_with_return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment