Class: Riff::RiffReader
Instance Method Summary collapse
- #chunks ⇒ Object
- #close ⇒ Object
-
#initialize(filename) ⇒ RiffReader
constructor
A new instance of RiffReader.
Constructor Details
#initialize(filename) ⇒ RiffReader
Returns a new instance of RiffReader.
75 76 77 |
# File 'lib/ruck/misc/riff.rb', line 75 def initialize(filename) @fn = File.open(filename, "rb") end |
Instance Method Details
#chunks ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/ruck/misc/riff.rb', line 79 def chunks return @chunks if @chunks return [] if @fn.closed? offset = 0 @chunks = [] until @fn.eof? chunk = RiffReaderChunk.new(@fn, offset) @chunks << chunk offset += 8 + chunk.size @fn.seek offset + 8 end @chunks end |
#close ⇒ Object
95 96 97 |
# File 'lib/ruck/misc/riff.rb', line 95 def close @fn.close unless @fn.closed? end |