Sha256: 67457f1342725533974b770e9649f703953cfd26a77b8f79c09d1e368e6468b0
Contents?: true
Size: 699 Bytes
Versions: 7
Compression:
Stored size: 699 Bytes
Contents
require 'semacode' #Ruby 1.8: gem install semacode - Ruby 1.9: gem install semacode-ruby19 require 'barby/barcode' module Barby #Uses the semacode library (gem install semacode) to encode DataMatrix barcodes class DataMatrix < Barcode2D attr_reader :data def initialize(data) self.data = data end def data=(data) @data = data @encoder = nil end def encoder @encoder ||= ::DataMatrix::Encoder.new(data) end def encoding encoder.data.map{|a| a.map{|b| b ? '1' : '0' }.join } end def semacode? #TODO: Not sure if this is right data =~ /^http:\/\// end def to_s data end end end
Version data entries
7 entries across 7 versions & 1 rubygems