Class: AudioTag::ID3::V2::Tag

Inherits:
StreamSection show all
Defined in:
lib/audio_tag/id3/v2/tag.rb

Instance Attribute Summary collapse

Attributes inherited from StreamReader

#stream

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StreamReader

#read, #read!, #read_byte, #read_byte!, #read_bytes, #read_bytes!, #read_bytes_until, #read_bytes_until!, #read_until, #read_until!

Constructor Details

#initialize(stream) ⇒ Tag

Returns a new instance of Tag.



7
8
9
10
11
# File 'lib/audio_tag/id3/v2/tag.rb', line 7

def initialize(stream)
  @header = TagHeader.new(stream)

  super(stream)
end

Instance Attribute Details

#framesObject (readonly)

Returns the value of attribute frames.



5
6
7
# File 'lib/audio_tag/id3/v2/tag.rb', line 5

def frames
  @frames
end

#headerObject (readonly)

Returns the value of attribute header.



5
6
7
# File 'lib/audio_tag/id3/v2/tag.rb', line 5

def header
  @header
end

Class Method Details

.from_file(path) ⇒ Object



17
18
19
# File 'lib/audio_tag/id3/v2/tag.rb', line 17

def self.from_file(path)
  File.open(path) { |file| new(file) }
end

Instance Method Details

#to_hObject



13
14
15
# File 'lib/audio_tag/id3/v2/tag.rb', line 13

def to_h
  FrameMerger.new(frames).merge
end