Module: Id3Taginator::Extensions::Optionable

Included in:
AudioFile, Id3Taginator
Defined in:
lib/id3taginator/extensions/optionable.rb

Instance Method Summary collapse

Instance Method Details

#add_size_frame(add_frame = true) ⇒ Self

Returns self for builder style

Parameters:

  • add_frame (Boolean) (defaults to: true)

    true to add the frame automatically if not present, else false

Returns:

  • (Self)

    returns self for builder style



67
68
69
70
# File 'lib/id3taginator/extensions/optionable.rb', line 67

def add_size_frame(add_frame = true)
  @options.add_size_frame = add_frame
  self
end

#default_decode_for_destination(encoding) ⇒ Self

sets the default decoding for destination

Parameters:

  • encoding (Encoding)

    the encoding to set

Returns:

  • (Self)

    returns self for builder style

Raises:



23
24
25
26
27
28
# File 'lib/id3taginator/extensions/optionable.rb', line 23

def default_decode_for_destination(encoding)
  raise Errors::Id3TagError, 'Encoding can\'t be nil' if encoding.nil?

  @options.default_decode_dest = encoding
  self
end

#default_encode_for_destination(encoding) ⇒ Self

sets the default encoding for destination

Parameters:

  • encoding (Encoding)

    the encoding to set

Returns:

  • (Self)

    returns self for builder style

Raises:



11
12
13
14
15
16
# File 'lib/id3taginator/extensions/optionable.rb', line 11

def default_encode_for_destination(encoding)
  raise Errors::Id3TagError, 'Encoding can\'t be nil' if encoding.nil?

  @options.default_encode_dest = encoding
  self
end

#ignore_v23_frame_error(ignore = true) ⇒ Self

if true, does not throw an error if a frame is added that is not supported for 2.3 e.g. Sort Order Frames

Parameters:

  • ignore (Boolean) (defaults to: true)

    true to ignore errors, else false

Returns:

  • (Self)

    returns self for builder style



46
47
48
49
# File 'lib/id3taginator/extensions/optionable.rb', line 46

def ignore_v23_frame_error(ignore = true)
  @options.ignore_v23_frame_error = ignore
  self
end

#ignore_v24_frame_error(ignore = true) ⇒ Self

if true, does not throw an error if a frame is added that is not supported for 2.4 e.g. Size Frame

Parameters:

  • ignore (Boolean) (defaults to: true)

    true to ignore errors, else false

Returns:

  • (Self)

    returns self for builder style



56
57
58
59
# File 'lib/id3taginator/extensions/optionable.rb', line 56

def ignore_v24_frame_error(ignore = true)
  @options.ignore_v24_frame_error = ignore
  self
end

#tag_padding(number_bytes) ⇒ Self

sets the padding

Parameters:

  • number_bytes (Integer)

    number of bytes to pad

Returns:

  • (Self)

    returns self for builder style



35
36
37
38
39
# File 'lib/id3taginator/extensions/optionable.rb', line 35

def tag_padding(number_bytes)
  number_bytes = 0 if number_bytes.nil?
  @options.padding_bytes = number_bytes
  self
end