Skip to content

Instantly share code, notes, and snippets.

@mwlang
Last active August 29, 2015 14:20
Show Gist options
  • Save mwlang/d016ea8b2593704bdfe2 to your computer and use it in GitHub Desktop.
Save mwlang/d016ea8b2593704bdfe2 to your computer and use it in GitHub Desktop.
block calling in ruby
def with_tmp_folder
puts "make the tmp folder"
yield if block_given?
ensure
puts "remove the temp folder"
end
with_tmp_folder do
puts "do your thing"
end
with_tmp_folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment