Method: BFS::Bucket::InMem#open
- Defined in:
- lib/bfs/bucket/in_mem.rb
#open(path, **_opts, &block) ⇒ Object
Opens an existing file for reading
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/bfs/bucket/in_mem.rb', line 76 def open(path, **_opts, &block) path = norm_path(path) raise BFS::FileNotFound, path unless @files.key?(path) io = @files[path].io io.reopen(io.string) return io unless block begin yield(io) ensure io.close end end |