class Alexandria::Scanners::KeyboardWedge
A simple keyboard-wedge style barcode scanner which presents scan data as if typed from a keyboard. (Modified CueCats act like this.)
Public Instance Methods
decode(data)
click to toggle source
Gets the essential 13-digits from an ISBN barcode (EAN-13)
# File lib/alexandria/scanners/keyboard.rb, line 44 def decode(data) data.gsub!(/\s/, "") if data.length == 10 data elsif data.length >= 13 data[0, 13] else raise format(_("Unknown scan data %s<data>"), data: data) end end
display_name()
click to toggle source
# File lib/alexandria/scanners/keyboard.rb, line 33 def display_name "Keyboard Wedge" end
match?(data)
click to toggle source
Checks if data looks like a completed scan
# File lib/alexandria/scanners/keyboard.rb, line 38 def match?(data) data.gsub!(/\s/, "") (data =~ /[0-9]{12,18}/) || (data =~ /[0-9]{9}[0-9Xx]/) end
name()
click to toggle source
# File lib/alexandria/scanners/keyboard.rb, line 29 def name "KeyboardWedge" end