class RQRCode::Export::SVG::Rect
def build(module_size, options = {})
def build(module_size, options = {}) # Extract values from options color = options[:color] offset_x = options[:offset_x].to_i offset_y = options[:offset_y].to_i # Prefix hexadecimal colors unless using a named color (symbol) color = "##{color}" unless color.is_a?(Symbol) @qrcode.modules.each_index do |c| tmp = [] @qrcode.modules.each_index do |r| x = r * module_size + offset_x y = c * module_size + offset_y next unless @qrcode.checked?(c, r) tmp << %(<rect width="#{module_size}" height="#{module_size}" x="#{x}" y="#{y}" fill="#{color}"/>) end @result << tmp.join end end