Module: Arrow::BlockClosable

Defined in:
lib/arrow/block-closable.rb

Instance Method Summary collapse

Instance Method Details

#open(*args, &block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/arrow/block-closable.rb', line 17

def open(*args, &block)
  io = new(*args)
  return io unless block

  begin
    yield(io)
  ensure
    io.close
  end
end