Last active
August 29, 2015 14:20
-
-
Save mwlang/d016ea8b2593704bdfe2 to your computer and use it in GitHub Desktop.
block calling in ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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