rQRCode, a Ruby library for encoding QR Codes
February 24th, 2008 @ 15:37 comments(8)
[Update]
I have also posted a bit more about the upcoming QR Code work for BBC /programmes.
We implemented QR Codes on /programmes (A project I’m one of the Software Engineer’s on, at the BBC) a few weeks back. They’ve been talked about since so I won’t repeat things, only to say it was a simple implementation using a JavaScript library by Kazuhiko Arase and took all of 5 minutes of my lunch hour to add. It started as an email by colleague Michael Smethhurst asking if we could/should implement them, and was also the first I had really heard of them.
Since then, I have done lots more research and think there is great mileage there for promotional material and advertising. At the moment the codes are built on the client side, but this will be moved to the server soon so we can start caching the pages, and also so we can provide the code in a more useful format (maybe images instead of the current HTML table).
So to the point of this post. During my research to understand QR Codes more and because of the lack of readable spec (Anyone know if there is one?) I decided to reverse engineer the JavaScript library into a Ruby Gem as there didn’t seem to be one out there. This helped me understand the how QR Codes are encoded, while at the same time giving something back for other people to use.
Anyway, it’s now done and there is a rQRCode Rubyforge project setup. You can also view the rRQRCode documentation (still to be improved) or just jump straight into installing the gem.
A quick simple example in the console:
Also, here is a quick example of using it in a Ruby on Rails project:
So that should get you going. I’m have some interesting features I working on adding so expect lots of updates over the next few weeks. Enjoy!
