ruby / tmpdir

Retrieve temporary directory path
5 stars 11 forks source link

refactor `Dir.tmpdir` - make it more idiomatic and functional #16

Closed pvdb closed 2 years ago

pvdb commented 2 years ago

Use Enumerable#find to iterate over the candidate directories, not Enumerable#each.

This gives the code a more functional "feel", and also makes it - IMO - slightly more idiomatic, as it avoids setting the "global" (by which I mean: non-local) tmp variable from inside the block.

pvdb commented 2 years ago

@nobu / @hsbt - I hope you don't mind me tagging you on this PR as the two active maintainers of this repo, and I hope you'll consider my suggested changes! :sweat_smile: