Sha256: 324b0bbd321686e5337794ca1625fa7fb409cee924f55c867e872420784e719d

Contents?: true

Size: 750 Bytes

Versions: 8

Compression:

Stored size: 750 Bytes

Contents

# Given an image, return an ordered array of detectable barcodes
# 
#
class Sqed::Parser::BarcodeParser < Sqed::Parser

  TYPE = :barcode

  attr_accessor :image

  attr_accessor :barcode

  def initialize(image)
    super
    @image = image
  end

  def barcode
    @barcode ||= get_barcode
    @barcode
  end

  # Uses the same enging as zbarimg that you can install with brew (zbarimg)
  #
  def get_code_128
    nil # ZXing.decode @image.filename
  end

  # try a bunch of options, organized by most common,  give the first hit
  def get_barcode
    [get_code_128].compact.first
  end 

 #def get_datamatrix
 #  https://github.com/srijan/ruby-dmtx
 #end

  # alias to a universal method
  def text(section_type: :default) 
    barcode
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sqed-0.3.2 lib/sqed/parser/barcode_parser.rb
sqed-0.3.1 lib/sqed/parser/barcode_parser.rb
sqed-0.3.0 lib/sqed/parser/barcode_parser.rb
sqed-0.2.4 lib/sqed/parser/barcode_parser.rb
sqed-0.2.3 lib/sqed/parser/barcode_parser.rb
sqed-0.2.2 lib/sqed/parser/barcode_parser.rb
sqed-0.2.1 lib/sqed/parser/barcode_parser.rb
sqed-0.2.0 lib/sqed/parser/barcode_parser.rb