Module: Helpema::ZBar
- Extended by:
- Helpema, ZBar
- Included in:
- ZBar
- Defined in:
- lib/helpema/zbar.rb
Constant Summary
Constants included
from Helpema
VERSION
Class Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Helpema
define_command, requires, run_command, to_arg
Class Attribute Details
.screenshot ⇒ Object
Returns the value of attribute screenshot.
6
7
8
|
# File 'lib/helpema/zbar.rb', line 6
def screenshot
@screenshot
end
|
.version ⇒ Object
Returns the value of attribute version.
6
7
8
|
# File 'lib/helpema/zbar.rb', line 6
def version
@version
end
|
Instance Method Details
#cam ⇒ Object
26
|
# File 'lib/helpema/zbar.rb', line 26
def cam() = ZBar._cam()
|
#img(filename) ⇒ Object
33
|
# File 'lib/helpema/zbar.rb', line 33
def img(filename) = ZBar._img(filename:filename)
|
#screen ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/helpema/zbar.rb', line 35
def screen
raw = nil
Dir.mktmpdir do |tmpdir|
_ = File.join(tmpdir, "#{$$}.#{Time.now.to_f}.png")
raw = _ if ZBar.snapshot(_) and not (_=ZBar.img(_).chomp).empty?
end
raw
end
|
#snapshot(filename) ⇒ Object
10
11
12
|
# File 'lib/helpema/zbar.rb', line 10
def snapshot(filename)
system(*ZBar.screenshot, filename)
end
|