Module: ZXing
- Defined in:
- lib/zxing.rb,
lib/zxing/client.rb,
lib/zxing/server.rb,
lib/zxing/decoder.rb,
lib/zxing/version.rb
Defined Under Namespace
Classes: Client, Decoder, Server, UndecodableError
Constant Summary collapse
- BIN =
File.('../../../bin/zxing', __FILE__)
- VERSION =
"0.4.0"
Class Method Summary collapse
-
.decode(file) ⇒ Object
Decodes barcodes from an image file.
-
.decode!(file) ⇒ Object
Same as
decode
, but raises an exception when image cannot be decoded. -
.decode_all(file) ⇒ Object
Decodes barcodes from an image file, and returns an array of encoded values.
-
.decode_all!(file) ⇒ Object
Same as
decode_all
, but raises an exception when image cannot be decoded.
Class Method Details
.decode(file) ⇒ Object
24 25 26 |
# File 'lib/zxing.rb', line 24 def self.decode(file) Decoder.decode normalize(file) end |
.decode!(file) ⇒ Object
38 39 40 |
# File 'lib/zxing.rb', line 38 def self.decode!(file) Decoder.decode! normalize(file) end |
.decode_all(file) ⇒ Object
Decodes barcodes from an image file, and returns an array of encoded values.
file
should be the path to the image file to decode, as a string.
Example:
path = "path/to/file.png"
ZXing.decode_all(path) #=> ["First encoded text","Second encoded text"]
When the image cannot be decoded, decode_all
returns nil
:
path = "./no_encoded_image.png"
ZXing.decode_all(path) #=> nil
58 59 60 |
# File 'lib/zxing.rb', line 58 def self.decode_all(file) Decoder.decode_all normalize(file) end |
.decode_all!(file) ⇒ Object
72 73 74 |
# File 'lib/zxing.rb', line 72 def self.decode_all!(file) Decoder.decode_all! normalize(file) end |