Class: WahWah::OggTag

Inherits:
Tag
  • Object
show all
Extended by:
TagDelegate
Defined in:
lib/wahwah/ogg_tag.rb

Constant Summary

Constants inherited from Tag

Tag::INSPECT_ATTRIBUTES, Tag::INTEGER_ATTRIBUTES

Instance Method Summary collapse

Methods included from TagDelegate

tag_delegate

Methods inherited from Tag

#images, #initialize, #inspect

Constructor Details

This class inherits a constructor from WahWah::Tag

Instance Method Details

#bitrateObject

Requires duration to calculate, so lazy as well.



30
31
32
# File 'lib/wahwah/ogg_tag.rb', line 30

def bitrate
  @bitrate ||= parse_bitrate
end

#durationObject

Oggs require reading to the end of the file in order to calculate their duration (as it’s not stored in any header or metadata). Thus, if the IO like object supplied to WahWah is a streaming download, getting the duration would download the entire audio file, which may not be desirable. Making it lazy in this manner allows the user to avoid that.



25
26
27
# File 'lib/wahwah/ogg_tag.rb', line 25

def duration
  @duration ||= parse_duration
end