Module: Id3Taginator::Frames::GroupingFrames
Instance Method Summary collapse
-
#group_identifications ⇒ Array<Frames::Grouping::Entities::GroupIdentification>
extracts the group information (GRID).
-
#group_identifications=(group) ⇒ Object
(also: #add_group_identification)
adds a group identification (GRID).
-
#grouping ⇒ String?
extracts the Grouping (GRP1).
-
#grouping=(grouping) ⇒ Object
sets the grouping (GRP1).
-
#remove_group_identification(owner_id) ⇒ Object
removes a group identification for the specific owner_id.
-
#remove_grouping ⇒ Object
removes the grouping frame.
Methods included from Frameable
#find_frame, #find_frames, #set_frame_fields, #set_frame_fields_by_selector, #unsupported_frame
Instance Method Details
#group_identifications ⇒ Array<Frames::Grouping::Entities::GroupIdentification>
extracts the group information (GRID)
11 12 13 14 15 16 17 18 |
# File 'lib/id3taginator/frames/grouping_frames.rb', line 11 def group_identifications frame = find_frames(Grouping::GroupIdentificationFrame.frame_id(@major_version, )) return [] if frame.nil? || frame.empty? frame.map do |f| Grouping::Entities::GroupIdentification.new(f.owner_id, f.group_symbol, f.group_dependant_data) end end |
#group_identifications=(group) ⇒ Object Also known as: add_group_identification
adds a group identification (GRID)
23 24 25 26 27 |
# File 'lib/id3taginator/frames/grouping_frames.rb', line 23 def group_identifications=(group) set_frame_fields_by_selector(Grouping::GroupIdentificationFrame, i[@group_symbol @group_dependant_data], ->(f) { f.owner_id == group.owner_id }, group.owner_id, group.group_symbol, group.group_dependant_data) end |
#grouping ⇒ String?
extracts the Grouping (GRP1)
44 45 46 |
# File 'lib/id3taginator/frames/grouping_frames.rb', line 44 def grouping find_frame(Grouping::GroupingFrame.frame_id(@major_version, ))&.grouping end |
#grouping=(grouping) ⇒ Object
sets the grouping (GRP1)
51 52 53 |
# File 'lib/id3taginator/frames/grouping_frames.rb', line 51 def grouping=(grouping) set_frame_fields(Grouping::GroupingFrame, [:@grouping], grouping) end |
#remove_group_identification(owner_id) ⇒ Object
removes a group identification for the specific owner_id
34 35 36 37 38 39 |
# File 'lib/id3taginator/frames/grouping_frames.rb', line 34 def remove_group_identification(owner_id) @frames.delete_if do |f| f.frame_id == Grouping::GroupIdentificationFrame.frame_id(@major_version, ) && f.owner_id == owner_id end end |
#remove_grouping ⇒ Object
removes the grouping frame
56 57 58 |
# File 'lib/id3taginator/frames/grouping_frames.rb', line 56 def remove_grouping @frames.delete_if { |f| f.frame_id == Grouping::GroupingFrame.frame_id(@major_version, ) } end |