Class: Sqed::Parser::BarcodeParser

Inherits:
Sqed::Parser show all
Defined in:
lib/sqed/parser/barcode_parser.rb

Overview

Given an image, return an ordered array of detectable barcodes

!! DOES NOTHING !!

Constant Summary collapse

TYPE =
:barcode

Instance Attribute Summary collapse

Attributes inherited from Sqed::Parser

#extracted_text, #image

Instance Method Summary collapse

Constructor Details

#initialize(image) ⇒ BarcodeParser

Returns a new instance of BarcodeParser.



11
12
13
14
# File 'lib/sqed/parser/barcode_parser.rb', line 11

def initialize(image)
  super
  @image = image
end

Instance Attribute Details

#barcodeObject

Returns the value of attribute barcode.



9
10
11
# File 'lib/sqed/parser/barcode_parser.rb', line 9

def barcode
  @barcode
end

Instance Method Details

#get_barcodeObject

try a bunch of options, organized by most common, give the first hit



28
29
30
# File 'lib/sqed/parser/barcode_parser.rb', line 28

def get_barcode
  [get_code_128].compact.first
end

#get_code_128Object

Uses the same engine as zbarimg that you can install with brew (zbarimg)



23
24
25
# File 'lib/sqed/parser/barcode_parser.rb', line 23

def get_code_128
  nil # ZXing.decode @image.filename
end

#get_text(section_type: :default) ⇒ Object

alias to a universal method



37
38
39
# File 'lib/sqed/parser/barcode_parser.rb', line 37

def get_text(section_type: :default)
  barcode
end