Module: Async::RSpec::Buffer
- Defined in:
- lib/async/rspec/buffer.rb
Constant Summary collapse
- TMP =
"/tmp"
Class Method Summary collapse
Class Method Details
.open(mode = 'w+', root: TMP) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/async/rspec/buffer.rb', line 13 def self.open(mode = 'w+', root: TMP) path = File.join(root, SecureRandom.hex(32)) file = File.open(path, mode) File.unlink(path) return file unless block_given? begin yield file ensure file.close end end |