Class: ZXing::Decoder
- Inherits:
-
Object
- Object
- ZXing::Decoder
- Defined in:
- lib/zxing/decoder.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
Class Method Summary collapse
- .decode(file) ⇒ Object
- .decode!(file) ⇒ Object
- .decode_all(file) ⇒ Object
- .decode_all!(file) ⇒ Object
Instance Method Summary collapse
- #decode ⇒ Object
- #decode_all ⇒ Object
-
#initialize(file) ⇒ Decoder
constructor
A new instance of Decoder.
- #reader ⇒ Object
Constructor Details
#initialize(file) ⇒ Decoder
Returns a new instance of Decoder.
50 51 52 |
# File 'lib/zxing/decoder.rb', line 50 def initialize(file) self.file = file end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
24 25 26 |
# File 'lib/zxing/decoder.rb', line 24 def file @file end |
Class Method Details
.decode(file) ⇒ Object
32 33 34 35 36 |
# File 'lib/zxing/decoder.rb', line 32 def self.decode(file) decode!(file) rescue UndecodableError nil end |
.decode!(file) ⇒ Object
26 27 28 29 30 |
# File 'lib/zxing/decoder.rb', line 26 def self.decode!(file) new(file).decode rescue NativeException raise UndecodableError end |
.decode_all(file) ⇒ Object
44 45 46 47 48 |
# File 'lib/zxing/decoder.rb', line 44 def self.decode_all(file) decode_all!(file) rescue UndecodableError [] end |
.decode_all!(file) ⇒ Object
38 39 40 41 42 |
# File 'lib/zxing/decoder.rb', line 38 def self.decode_all!(file) new(file).decode_all rescue NativeException raise UndecodableError end |
Instance Method Details
#decode ⇒ Object
58 59 60 |
# File 'lib/zxing/decoder.rb', line 58 def decode reader.decode(bitmap).to_s end |
#decode_all ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/zxing/decoder.rb', line 62 def decode_all = GenericMultipleBarcodeReader.new(reader) .decode_multiple(bitmap).map do |result| result.get_text end end |
#reader ⇒ Object
54 55 56 |
# File 'lib/zxing/decoder.rb', line 54 def reader MultiFormatReader.new end |