I personally found it hard to understand the idea of the behavior:reading a file, analyzing the data, and then closing the file.
We want definition the method, it will look like the code above.
One small issue is that if a critical IO error occurs, we have no control over it, or even if we do, no information about it.
"Tap" is preferable here, as tap means "insert" in object-oriented terms.
pcms = Array.new
File.open(fname, "rb") do |f|
pcms = Wave::RIFF.read(f)
end
pcms #=> *Wave::PCM
I personally found it hard to understand the idea of the behavior:reading a file, analyzing the data, and then closing the file.
We want definition the method, it will look like the code above.
One small issue is that if a critical IO error occurs, we have no control over it, or even if we do, no information about it.
"Tap" is preferable here, as tap means "insert" in object-oriented terms.
We call this implementation model "tapping".