Class: ID3Tag::ID3v2TagHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/id3tag/id3_v2_tag_header.rb

Instance Method Summary collapse

Constructor Details

#initialize(header_chunk) ⇒ ID3v2TagHeader

Returns a new instance of ID3v2TagHeader.



3
4
5
# File 'lib/id3tag/id3_v2_tag_header.rb', line 3

def initialize(header_chunk)
  @content = StringIO.new(header_chunk)
end

Instance Method Details

#experimental?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/id3tag/id3_v2_tag_header.rb', line 29

def experimental?
  flags_byte[5] == 1
end

#extended_header?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/id3tag/id3_v2_tag_header.rb', line 25

def extended_header?
  flags_byte[6] == 1
end

Returns:

  • (Boolean)


33
34
35
# File 'lib/id3tag/id3_v2_tag_header.rb', line 33

def footer_present?
  flags_byte[4] == 1
end

#inspectObject



41
42
43
# File 'lib/id3tag/id3_v2_tag_header.rb', line 41

def inspect
  "<#{self.class.name} version:2.#{version_number} size:#{tag_size} unsync:#{unsynchronisation?} ext.header:#{extended_header?} experimental:#{experimental?} footer:#{footer_present?}>"
end

#major_version_numberObject



7
8
9
10
# File 'lib/id3tag/id3_v2_tag_header.rb', line 7

def major_version_number
  @content.seek(3)
  @content.readbyte
end

#minor_version_numberObject



12
13
14
15
# File 'lib/id3tag/id3_v2_tag_header.rb', line 12

def minor_version_number
  @content.seek(4)
  @content.readbyte
end

#tag_sizeObject



37
38
39
# File 'lib/id3tag/id3_v2_tag_header.rb', line 37

def tag_size
  @tag_size ||= get_tag_size
end

#unsynchronisation?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/id3tag/id3_v2_tag_header.rb', line 21

def unsynchronisation?
  flags_byte[7] == 1
end

#version_numberObject



17
18
19
# File 'lib/id3tag/id3_v2_tag_header.rb', line 17

def version_number
  sprintf("%s.%s", major_version_number, minor_version_number)
end