Class: Vorbis::Comments

Inherits:
BinData::BasePrimitive
  • Object
show all
Defined in:
lib/vorbis.rb

Overview

A BinData::BasePrimitive which represents a list of comments as per the Vorbis I comment header specification.

Instance Method Summary collapse

Instance Method Details

#read_and_return_value(io) ⇒ Object


109
110
111
112
113
114
115
116
117
118
119
# File 'lib/vorbis.rb', line 109

def read_and_return_value(io)
  n_comments = read_uint32le(io)
  comments = InsensitiveHash.new
  n_comments.times do
    length = read_uint32le(io)
    comment = io.readbytes(length)
    key, value = comment.split('=', 2)
    (comments[key] ||= []) << value
  end
  return comments
end

#read_uint32le(io) ⇒ Object


125
126
127
# File 'lib/vorbis.rb', line 125

def read_uint32le(io)
  return BinData::Uint32le.read(io)
end

#sensible_defaultObject


121
122
123
# File 'lib/vorbis.rb', line 121

def sensible_default
  return {}
end