Class: Id3Taginator::Frames::CustomFrame

Inherits:
Id3v2Frame
  • Object
show all
Defined in:
lib/id3taginator/frames/custom_frame.rb

Constant Summary

Constants inherited from Id3v2Frame

Id3v2Frame::HEADER_SIZE_V_2, Id3v2Frame::HEADER_SIZE_V_3_4

Constants included from Extensions::Encodable

Extensions::Encodable::ISO8859_1, Extensions::Encodable::UNICODE_ZERO, Extensions::Encodable::UTF_16, Extensions::Encodable::UTF_16BE, Extensions::Encodable::UTF_8, Extensions::Encodable::ZERO

Instance Attribute Summary collapse

Attributes inherited from Id3v2Frame

#frame_id, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Id3v2Frame

build_id3_flags, build_v2_frame, build_v3_frame, build_v4_frame, #compression?, #encryption?, #file_alter_preservation?, #frame_size, #group_identity?, #initialize, #re_calc_payload_size, #read_only?, #tag_alter_preservation?, #to_bytes

Methods included from Extensions::ArgumentCheck

#argument_between_num, #argument_boolean, #argument_exactly_chars, #argument_less_than_chars, #argument_more_than_chars, #argument_not_empty, #argument_not_nil, #argument_sym, included

Methods included from Extensions::Encodable

#decode, #decode_using_encoding_byte, #default_encoding_destination_byte, #encode, #encode_and_add_encoding_byte, #encode_string, #find_encoding, #find_encoding_byte, included, #merge, #pad_left, #pad_right, #read_stream_until, #remove_trailing_zeros, #zero_byte

Constructor Details

This class inherits a constructor from Id3Taginator::Frames::Id3v2Frame

Instance Attribute Details

#contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/id3taginator/frames/custom_frame.rb', line 7

def content
  @content
end

Class Method Details

.build_frame(content, _options = nil, id3_version: 3) ⇒ Id3v2Frame

builds a custom frame

Parameters:

  • content (String)

    the content

  • options (Options::Options)

    options to use

  • id3_version (Integer) (defaults to: 3)

    the id3 version to build the frame for

Returns:



16
17
18
19
20
21
22
# File 'lib/id3taginator/frames/custom_frame.rb', line 16

def self.build_frame(content, _options = nil, id3_version: 3)
  argument_not_nil(content, 'content')

  frame = new(frame_id, 0, build_id3_flags(id3_version), '')
  frame.content = content
  frame
end

Instance Method Details

#content_to_bytesString

returns the content as it is, no encoding or other modifications are performed

Returns:

  • (String)

    the content



34
35
36
# File 'lib/id3taginator/frames/custom_frame.rb', line 34

def content_to_bytes
  @content
end

#process_content(content) ⇒ Object

takes the content as it is, no encoding or other modifications are performed

Parameters:

  • content (String)

    the content



27
28
29
# File 'lib/id3taginator/frames/custom_frame.rb', line 27

def process_content(content)
  @content = content
end