Class: Id3Taginator::Frames::Id3v23FrameFlags

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

Instance Method Summary collapse

Constructor Details

#initialize(flags) ⇒ Id3v23FrameFlags

Returns a new instance of Id3v23FrameFlags.



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

def initialize(flags)
  @flags = flags
end

Instance Method Details

#compression?Boolean

determined if the frame is compressed

Returns:

  • (Boolean)

    true if the frame is compressed, else false



42
43
44
45
# File 'lib/id3taginator/frames/id3v23_frame_flags.rb', line 42

def compression?
  flag = @flags.bytes[1]
  (flag & 0b1000_0000) == 0b1000_0000
end

#encryption?Boolean

determined if the frame is encrypted

Returns:

  • (Boolean)

    true if the frame is encrypted, else false



50
51
52
53
# File 'lib/id3taginator/frames/id3v23_frame_flags.rb', line 50

def encryption?
  flag = @flags.bytes[1]
  (flag & 0b0100_0000) == 0b0100_0000
end

#file_alter_preservation?Boolean

determined if the file is alter preserved

Returns:

  • (Boolean)

    true if the file is alter preserved, else false



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

def file_alter_preservation?
  flag = @flags.bytes[0]
  (flag & 0b0100_0000) == 0b0100_0000
end

#group_identity?Boolean

determined if the frame has a group identity

Returns:

  • (Boolean)

    true if the frame has a group identity, else false



58
59
60
61
# File 'lib/id3taginator/frames/id3v23_frame_flags.rb', line 58

def group_identity?
  flag = @flags.bytes[1]
  (flag & 0b0010_0000) == 0b0010_0000
end

#read_only?Boolean

determined if the file frame is read only

Returns:

  • (Boolean)

    true if frame is read only, else false



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

def read_only?
  flag = @flags.bytes[0]
  (flag & 0b0010_0000) == 0b0010_0000
end

#tag_alter_preservation?Boolean

determined if the frame is alter preserved

Returns:

  • (Boolean)

    true if alter preserved, else false



18
19
20
21
# File 'lib/id3taginator/frames/id3v23_frame_flags.rb', line 18

def tag_alter_preservation?
  flag = @flags.bytes[0]
  (flag & 0b1000_0000) == 0b1000_0000
end

#to_bytesObject



11
12
13
# File 'lib/id3taginator/frames/id3v23_frame_flags.rb', line 11

def to_bytes
  @flags
end