module EasyTag::MP4AttributeAccessors
Public Instance Methods
data_from_item(item, **opts)
click to toggle source
# File lib/easytag/attributes/mp4.rb, line 16 def data_from_item(item, **opts) case opts[:data_type] when :string_list item.to_string_list when :bool item.to_bool when :int item.to_int when :int_pair item.to_int_pair when :cover_art_list item.to_cover_art_list.collect { |img| EasyTag::Image.new(img.data) } else item.to_string_list[0] end end
item_reader(attr_name, key = nil, **opts)
click to toggle source
# File lib/easytag/attributes/mp4.rb, line 7 def item_reader(attr_name, key = nil, **opts) key = attr_name if key.nil? opts[:returns] = opts[:data_type] if opts[:returns].nil? && opts[:cast].nil? # clunky define_method(attr_name) do v = self.class.read_item(taglib, key, **opts) self.class.post_process(v, **opts) end end
read_item(taglib, key, **opts)
click to toggle source
# File lib/easytag/attributes/mp4.rb, line 33 def read_item(taglib, key, **opts) item = taglib.tag.item_list_map[key] data_from_item(item, **opts) unless item.nil? end