artoo icon indicating copy to clipboard operation
artoo copied to clipboard

method #close doesn't exists for File class

Open hoblin opened this issue 6 years ago • 0 comments

https://github.com/hybridgroup/artoo/blob/e5e67f6659fa3c5530d28a2a324810c7673e8735/lib/artoo/adaptors/io/digital_pin.rb#L17

When you open file in Ruby using File.open with block, file closes automatically.

File.open(...){ |f| f << something }

You need to close file only if you use open without block. It this case open is just synonym for new

f = File.open(...)
f << something
f.close

hoblin avatar Jul 02 '18 18:07 hoblin