Module: WahWah

Defined in:
lib/wahwah.rb,
lib/wahwah/tag.rb,
lib/wahwah/errors.rb,
lib/wahwah/helper.rb,
lib/wahwah/id3/v1.rb,
lib/wahwah/id3/v2.rb,
lib/wahwah/asf_tag.rb,
lib/wahwah/mp3_tag.rb,
lib/wahwah/mp4_tag.rb,
lib/wahwah/ogg_tag.rb,
lib/wahwah/version.rb,
lib/wahwah/flac_tag.rb,
lib/wahwah/mp4/atom.rb,
lib/wahwah/ogg/page.rb,
lib/wahwah/riff_tag.rb,
lib/wahwah/id3/frame.rb,
lib/wahwah/lazy_read.rb,
lib/wahwah/ogg/pages.rb,
lib/wahwah/asf/object.rb,
lib/wahwah/flac/block.rb,
lib/wahwah/riff/chunk.rb,
lib/wahwah/ogg/packets.rb,
lib/wahwah/ogg/flac_tag.rb,
lib/wahwah/ogg/opus_tag.rb,
lib/wahwah/tag_delegate.rb,
lib/wahwah/id3/v2_header.rb,
lib/wahwah/id3/frame_body.rb,
lib/wahwah/ogg/vorbis_tag.rb,
lib/wahwah/mp3/vbri_header.rb,
lib/wahwah/mp3/xing_header.rb,
lib/wahwah/ogg/vorbis_comment.rb,
lib/wahwah/id3/text_frame_body.rb,
lib/wahwah/id3/genre_frame_body.rb,
lib/wahwah/id3/image_frame_body.rb,
lib/wahwah/flac/streaminfo_block.rb,
lib/wahwah/id3/lyrics_frame_body.rb,
lib/wahwah/mp3/mpeg_frame_header.rb,
lib/wahwah/id3/comment_frame_body.rb

Defined Under Namespace

Modules: Asf, Flac, Helper, ID3, LazyRead, Mp3, Mp4, Ogg, Riff, TagDelegate Classes: AsfTag, FlacTag, Mp3Tag, Mp4Tag, OggTag, RiffTag, Tag, WahWahArgumentError, WahWahNotImplementedError

Constant Summary collapse

FORMATE_MAPPING =
{
  Mp3Tag: ["mp3"],
  OggTag: ["ogg", "oga", "opus"],
  RiffTag: ["wav"],
  FlacTag: ["flac"],
  AsfTag: ["wma"],
  Mp4Tag: ["m4a"]
}.freeze
VERSION =
"1.6.6"

Class Method Summary collapse

Class Method Details

.open(path_or_io) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/wahwah.rb', line 63

def self.open(path_or_io)
  with_io path_or_io do |io, from_path|
    file_format = Helper.file_format io

    raise WahWahArgumentError, "No supported format found" unless support_formats.include? file_format

    FORMATE_MAPPING.each do |tag, formats|
      break const_get(tag).new(io, **from_path) if formats.include?(file_format)
    end
  end
end

.support_formatsObject



75
76
77
# File 'lib/wahwah.rb', line 75

def self.support_formats
  FORMATE_MAPPING.values.flatten
end