artoo
artoo copied to clipboard
method #close doesn't exists for File class
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