Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A Ruby library that encodes QR Codes
Branch: master
Pull request Compare This branch is 110 commits behind whomwah:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


== rQRCode, Encode QRCodes

rQRCode is a library for encoding QR Codes in Ruby. It has a simple interface with all the standard qrcode options. It was adapted from the Javascript library by Kazuhiko Arase.

== An Overview

Let's clear up some rQRCode stuff.

 # rQRCode is a *standalone library*. It requires no other libraries. Just Ruby!
 # It is an encoding library. You can't decode QR codes with it.
 # The interface is simple and assumes you just want to encode a string into a QR code
 # QR code is trademarked by Denso Wave inc

== Resources

Denso-Wave website::

== Installing

You may get the latest stable version from Rubyforge. 

  $ gem install rqrcode

You can also get the source from

  $ git clone git://

=== Loading rQRCode Itself

You have installed the gem already, yeah?

 require 'rubygems'
 require 'rqrcode'

=== Simple QRCode generation to screen

 qr = 'my string to generate', :size => 4, :level => :h )
 puts qr.to_s
 # Prints:
 # xxxxxxx x  x x   x x  xx  xxxxxxx
 # x     x  xxx  xxxxxx xxx  x     x
 # x xxx x  xxxxx x       xx x xxx x
 # ... etc

=== Simple QRCode generation to view (RubyOnRails)

 @qr = 'my string to generate', :size => 4, :level => :h )

<b>View: (minimal styling added)</b>
 <style type="text/css">
 table {
   border-width: 0;
   border-style: none;
   border-color: #0000ff;
   border-collapse: collapse;
 td {
   border-width: 0; 
   border-style: none;
   border-color: #0000ff; 
   border-collapse: collapse; 
   padding: 0; 
   margin: 0; 
   width: 10px; 
   height: 10px; 
 } { background-color: #000; }
 td.white { background-color: #fff; }

 <% @qr.modules.each_index do |x| %>
   <% @qr.modules.each_index do |y| %>
    <% if @qr.dark?(x,y) %>
     <td class="black"/>
    <% else %>
     <td class="white"/>
    <% end %>
   <% end %>
 <% end %>

== Contact

Author::     Duncan Robertson 
Home Page::
License::    MIT Licence (
Something went wrong with that request. Please try again.