Skip to content

Instantly share code, notes, and snippets.

@bakkdoor
Created February 2, 2011 06:31
Show Gist options
  • Save bakkdoor/807330 to your computer and use it in GitHub Desktop.
Save bakkdoor/807330 to your computer and use it in GitHub Desktop.
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