Class: Id3Taginator::Frames::Picture::Entities::Picture

Inherits:
Object
  • Object
show all
Includes:
Extensions::Comparable
Defined in:
lib/id3taginator/frames/picture/entities/picture.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Extensions::Comparable

#==, #compare

Constructor Details

#initialize(mime_type, picture_type, descriptor, picture_data) ⇒ Picture

constructor

Parameters:

  • mime_type (String)

    the mime type e.g. image/png. ‘–>’ if the image is a reference, e.g. a URI

  • picture_type (Symbol, nil)

    the picture type, all types can be found in Picture::PictureType

  • descriptor (String)

    the description

  • picture_data (String)

    the picture data bytes represented as a String (str.bytes)



18
19
20
21
22
23
# File 'lib/id3taginator/frames/picture/entities/picture.rb', line 18

def initialize(mime_type, picture_type, descriptor, picture_data)
  @mime_type = mime_type
  @picture_type = picture_type
  @descriptor = descriptor
  @picture_data = picture_data
end

Instance Attribute Details

#descriptorObject

Returns the value of attribute descriptor.



10
11
12
# File 'lib/id3taginator/frames/picture/entities/picture.rb', line 10

def descriptor
  @descriptor
end

#mime_typeObject

Returns the value of attribute mime_type.



10
11
12
# File 'lib/id3taginator/frames/picture/entities/picture.rb', line 10

def mime_type
  @mime_type
end

#picture_dataObject

Returns the value of attribute picture_data.



10
11
12
# File 'lib/id3taginator/frames/picture/entities/picture.rb', line 10

def picture_data
  @picture_data
end

#picture_typeObject

Returns the value of attribute picture_type.



10
11
12
# File 'lib/id3taginator/frames/picture/entities/picture.rb', line 10

def picture_type
  @picture_type
end

Instance Method Details

#write_picture(file) ⇒ Object



25
26
27
# File 'lib/id3taginator/frames/picture/entities/picture.rb', line 25

def write_picture(file)
  File.open(file, 'wb') { |f| f.write(@picture_data) }
end