Sha256: fb68f5376c6219e5cd1d5b75d0bbc969fc9419f041a9c94f0cd7c275f93505d3

Contents?: true

Size: 749 Bytes

Versions: 5

Compression:

Stored size: 749 Bytes

Contents

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

  TYPE = :barcode

  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 get_text(section_type: :default)
    barcode
  end


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sqed-0.4.4 lib/sqed/parser/barcode_parser.rb
sqed-0.4.3 lib/sqed/parser/barcode_parser.rb
sqed-0.4.2 lib/sqed/parser/barcode_parser.rb
sqed-0.4.1 lib/sqed/parser/barcode_parser.rb
sqed-0.4.0 lib/sqed/parser/barcode_parser.rb