Module: Id3Taginator::Frames::CommentFrames
Instance Method Summary collapse
-
#comment=(comment) ⇒ Object
(also: #add_comment)
adds a comment (COMM/COM) Multiple ones can be added, as long as they have different language/descriptor.
-
#comments ⇒ Array<Frames::Comment::Entities::Comment>
extracts the comments (COMM/COM).
-
#remove_comment(language, descriptor) ⇒ Object
removes a comment for the specific language and descriptor.
Methods included from Frameable
#find_frame, #find_frames, #set_frame_fields, #set_frame_fields_by_selector, #unsupported_frame
Instance Method Details
#comment=(comment) ⇒ Object Also known as: add_comment
adds a comment (COMM/COM) Multiple ones can be added, as long as they have different language/descriptor
22 23 24 25 26 |
# File 'lib/id3taginator/frames/comment_frames.rb', line 22 def comment=(comment) set_frame_fields_by_selector(Comment::CommentFrame, i[@language @descriptor @text], ->(f) { f.language == comment.language && f.descriptor == comment.descriptor }, comment.language, comment.descriptor, comment.text) end |
#comments ⇒ Array<Frames::Comment::Entities::Comment>
extracts the comments (COMM/COM)
11 12 13 14 15 16 |
# File 'lib/id3taginator/frames/comment_frames.rb', line 11 def comments frame = find_frames(Comment::CommentFrame.frame_id(@major_version, )) return [] if frame.nil? || frame.empty? frame.map { |f| Comment::Entities::Comment.new(f.language, f.descriptor, f.text) } end |
#remove_comment(language, descriptor) ⇒ Object
removes a comment for the specific language and descriptor
34 35 36 37 38 39 |
# File 'lib/id3taginator/frames/comment_frames.rb', line 34 def remove_comment(language, descriptor) @frames.delete_if do |f| f.frame_id == Comment::CommentFrame.frame_id(@major_version, ) && f.language == language && f.descriptor == descriptor end end |