Sha256: cbaa8d112c850fd04ea2f936fa62563abb251715a3ddb558d3f977c01dabb1d3

Contents?: true

Size: 752 Bytes

Versions: 16

Compression:

Stored size: 752 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 engine 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

16 entries across 16 versions & 1 rubygems

Version Path
sqed-0.8.3 lib/sqed/parser/barcode_parser.rb
sqed-0.8.2 lib/sqed/parser/barcode_parser.rb
sqed-0.8.1 lib/sqed/parser/barcode_parser.rb
sqed-0.8.0 lib/sqed/parser/barcode_parser.rb
sqed-0.7.1 lib/sqed/parser/barcode_parser.rb
sqed-0.7.0 lib/sqed/parser/barcode_parser.rb
sqed-0.6.0 lib/sqed/parser/barcode_parser.rb
sqed-0.5.8 lib/sqed/parser/barcode_parser.rb
sqed-0.5.7 lib/sqed/parser/barcode_parser.rb
sqed-0.5.6 lib/sqed/parser/barcode_parser.rb
sqed-0.5.5 lib/sqed/parser/barcode_parser.rb
sqed-0.5.4 lib/sqed/parser/barcode_parser.rb
sqed-0.5.3 lib/sqed/parser/barcode_parser.rb
sqed-0.5.2 lib/sqed/parser/barcode_parser.rb
sqed-0.5.1 lib/sqed/parser/barcode_parser.rb
sqed-0.5.0 lib/sqed/parser/barcode_parser.rb