Class: ZXing::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/zxing/client.rb

Class Method Summary collapse

Class Method Details

.newObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/zxing/client.rb', line 8

def self.new
  port = find_available_port
  remote_client = IO.popen("#{ZXing::BIN} #{port}")

  sleep 0.5 until responsive?(port)

  at_exit { Process.kill(:INT, remote_client.pid) }
  client = DRbObject.new_with_uri("druby://127.0.0.1:#{port}")
  client
end