Newer versions of the rqrcode gem have native svg output, rendering this obsolete.
Generate QR Codes as vector graphics. This package adds a to_svg method to the excellent rqrcode gem. It's pure Ruby, with no outside dependencies on heavier image manipulation or XML tools like RMagick or Nokogiri.
gem install rqrcode_to_svgStart by creating an RQRCode::QRCode object as supplied by rqrcode.
qr = RQRCode::QRCode.new("http://www.google.com", :size => 4, :level => 'h')An SVG is just one step away.
qr.to_svgWithout any options, this will return a string of the SVG's XML.
But there are many options.
qr.to_svg(:file => 'test.svg', :px => 4, :border => true, :namespace => false, :indent => false):filewill write the SVG out to a file and return the path.:pxincreases the size of each code-point by the given number of pixels-per-side-of-the-square. Defaults to4.:bordertoggles the border around the QR code. Defaults tofalse.:namespacetoggles use of the XML namespace prefix within the SVG. Defaults tofalse.:indenttoggles the pretty printing of the SVG's internal XML. Defaults to tag soup atfalse.
All options optional. Check out the documentation within the code for additional tweaks.