# frozen_string_literal: true module Axlsx # a vml drawing used for comments in Excel. class VmlDrawing # creates a new Vml Drawing object. # @param [Comments] comments the comments object this drawing is associated with def initialize(comments) raise ArgumentError, "you must provide a comments object" unless comments.is_a?(Comments) @comments = comments end # The part name for this vml drawing # @return [String] def pn format(VML_DRAWING_PN, @comments.worksheet.index + 1) end # serialize the vml_drawing to xml. # @param [String] str # @return [String] def to_xml_string(str = +'') str << <<~XML XML @comments.each { |comment| comment.vml_shape.to_xml_string str } str << "" end end end