Sha256: addf7cb14ee3be26d5bfda5cf38f5f3d5e63396ac3b4e589a8e1fd2e32021142
Contents?: true
Size: 830 Bytes
Versions: 1
Compression:
Stored size: 830 Bytes
Contents
module PM class Patch attr_accessor :name, :connections, :start_bytes def initialize(name, start_bytes=nil) @name = name @connections = [] @start_bytes = start_bytes @running = false end def <<(conn) @connections << conn end def inputs @connections.map(&:input).uniq end # Send start_bytes to each connection, then spawn a new thread that # receives input and passes it on to each connection. def start input_devices = inputs() @connections.each { |conn| conn.start(@start_bytes) } @running = true Thread.new do loop do break unless @running input_devices.map(&:gets_data) end end end def running? @running end def stop if @running @running = false @connections.map(&:stop) end end end end # PM
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
patchmaster-0.0.0 | lib/patchmaster/patch.rb |