module DocXify module Element class Image < Base attr_accessor :file, :align, :height_cm, :width_cm def initialize(file, options = {}) super() @file = file @align = options[:align] || :left @height_cm = options[:height_cm] || 5 @width_cm = options[:width_cm] || 5 end def id rand(1_000_000_000) end def to_s(_container = nil) xml = "" if @align == :right xml << <<~XML XML elsif @align == :center xml << <<~XML XML end xml << <<~XML XML end end end end