Created
February 2, 2011 06:31
-
-
Save bakkdoor/807330 to your computer and use it in GitHub Desktop.
This file contains hidden or 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_fs: block { | |
tmp_path_names = [] | |
block arity times: |i| { | |
path = "/tmp/tmp_path_#{i}" | |
tmp_path_names << path | |
Directory create: path | |
} | |
block call: tmp_path_names | |
tmp_path_names each: |p| { | |
Directory delete!: p | |
} | |
} | |
# usage: | |
with_tmp_fs: |tmp1 tmp2 tmp3| { | |
# do stuff here with tmp paths | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment