Method: Async::IO::Stream.open

Defined in:
lib/async/io/stream.rb

.open(path, mode = "r+", **options) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/async/io/stream.rb', line 33

def self.open(path, mode = "r+", **options)
	stream = self.new(File.open(path, mode), **options)
	
	return stream unless block_given?
	
	begin
		yield stream
	ensure
		stream.close
	end
end