Sha256: 62007ba96ab051a3d641fbb2dd6a37750f146e40e1a6b034de1df9e56b14a9d9

Contents?: true

Size: 688 Bytes

Versions: 4

Compression:

Stored size: 688 Bytes

Contents

# Given an image, return an ordered array of detectable barcodes

class Sqed::Parser::BarcodeParser < Sqed::Parser
  attr_accessor :barcodes

  def initialize(image)
    super
    @barcodes = bar_codes
  end

  def bar_codes
    # process the images, spit out the barcodes
    # return ZXing.decode_all(@image)   #['ABC 123', 'DEF 456']
    # a = `/usr/local/Cellar/zbar/0.10_1/bin/zbarimg ~/src/sqed/spec/support/files/test_barcode.JPG`
    # b = a.split("\n")
    f = 'SessionID_BarcodeImage.JPG'
    i = @image[:image]
    if i.nil?
      i = @image
    end
    i.write("tmp/#{f}")
    c = `/usr/local/Cellar/zbar/0.10_1/bin/zbarimg #{f}`
    d = c.split("\n")
    return d
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sqed-0.0.4 lib/sqed/parser/barcode_parser.rb
sqed-0.0.3 lib/sqed/parser/barcode_parser.rb
sqed-0.0.2 lib/sqed/parser/barcode_parser.rb
sqed-0.0.1 lib/sqed/parser/barcode_parser.rb