Module: EasyTag::FLACAttributeAccessors

Included in:
FLACTagger
Defined in:
lib/easytag/attributes/flac.rb

Instance Method Summary collapse

Instance Method Details

#album_art_reader(attr_name, **opts) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/easytag/attributes/flac.rb', line 13

def album_art_reader(attr_name, **opts)
  define_method(attr_name) do
    taglib.picture_list.collect do |pic|
      EasyTag::Image.new(pic.data).tap do |img|
        img.mime_type = pic.mime_type
        img.type      = pic.type
      end
    end
  end
end

#field_reader(attr_name, fields = nil, **opts) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/easytag/attributes/flac.rb', line 5

def field_reader(attr_name, fields = nil, **opts)
  fields = attr_name.to_s.upcase if fields.nil?
  define_method(attr_name) do
    v = self.class.read_fields(taglib.xiph_comment, fields, **opts)
    self.class.post_process(v, **opts)
  end
end