Class: AudioTag::ID3::V2::Frame
- Inherits:
-
StreamSection
- Object
- StreamReader
- StreamSection
- AudioTag::ID3::V2::Frame
- Defined in:
- lib/audio_tag/id3/v2/frame.rb
Direct Known Subclasses
AudioTag::ID3::V2::Frames::CommentFrame, AudioTag::ID3::V2::Frames::PictureFrame, AudioTag::ID3::V2::Frames::UserFrame
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Attributes inherited from StreamReader
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(stream, header: FrameHeader.new(stream)) ⇒ Frame
constructor
A new instance of Frame.
- #key ⇒ Object
- #to_h ⇒ Object
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, header: FrameHeader.new(stream)) ⇒ Frame
Returns a new instance of Frame.
7 8 9 10 11 |
# File 'lib/audio_tag/id3/v2/frame.rb', line 7 def initialize(stream, header: FrameHeader.new(stream)) @header = header super(stream) end |
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
5 6 7 |
# File 'lib/audio_tag/id3/v2/frame.rb', line 5 def header @header end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
5 6 7 |
# File 'lib/audio_tag/id3/v2/frame.rb', line 5 def raw_data @raw_data end |
Class Method Details
.build(stream) ⇒ Object
25 26 27 28 29 |
# File 'lib/audio_tag/id3/v2/frame.rb', line 25 def self.build(stream) header = FrameHeader.new(stream) header.frame_class.new(stream, header:) end |
Instance Method Details
#data ⇒ Object
17 18 19 |
# File 'lib/audio_tag/id3/v2/frame.rb', line 17 def data TextDecoder.decode(raw_data) end |
#key ⇒ Object
13 14 15 |
# File 'lib/audio_tag/id3/v2/frame.rb', line 13 def key header.key end |
#to_h ⇒ Object
21 22 23 |
# File 'lib/audio_tag/id3/v2/frame.rb', line 21 def to_h { key => data } end |