Code Monkey home page Code Monkey logo

ruby-qr's Introduction

Ruby QR

QR barcode generation in Ruby.

Not to be used, Programming exercise

This is just the result of me trying to learn more about QR codes and improve my Ruby skills. It is not intended to be used in any way.

How to Use, If you Must

ruby -Ilib qr.rb 'Hello World!'

Sample output when run from a terminal:

Sample

Algorithm Composition

I have experimented with different ways of composing the parts of the algorithm out of simpler modules.

The current method extends the instance of a QR code object with each of the different modules involved. Each module can affect the final code by implementing one of the following methods:

  • dark?
  • max
  • data
  • format
  • data_column?

dark? x, y, max

Returns true if the module at position x,y should be dark.

max

The maximum horizontal or vertical index for a module in the code.

data

Provides the actual content of the code including padding and error correction bits.

format

The format function returns the format bits to be used in the final code. The format indicates which error correction level is used for the data as well as what mask is applied to the data. This function is thus overriden by all error correction modules and mask modules.

The format bits themselves have error correction and a mask applied, it is therefore overriden by the FormatMask and FormatErrorCorrection modules.

data_column?

This function is used to determine if the column contains any content/data bits. This is only implemented by the Timing module, where the vertical timing column does not contain any data modules.

ruby-qr's People

Contributors

trevorpower avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.