class RQRCode::Export::SVG::Rect

Public Instance Methods

build(module_size, offset, color) click to toggle source
# File lib/rqrcode/export/svg.rb, line 84
def build(module_size, offset, color)
  @qrcode.modules.each_index do |c|
    tmp = []
    @qrcode.modules.each_index do |r|
      y = c * module_size + offset
      x = r * module_size + offset

      next unless @qrcode.checked?(c, r)
      tmp << %(<rect width="#{module_size}" height="#{module_size}" x="#{x}" y="#{y}" style="fill:##{color}"/>)
    end

    @result << tmp.join
  end
end