class PM::Patch
Attributes
connections[RW]
name[RW]
start_bytes[RW]
stop_bytes[RW]
Public Class Methods
new(name, start_bytes=nil, stop_bytes=nil)
click to toggle source
# File lib/patchmaster/patch.rb, line 7 def initialize(name, start_bytes=nil, stop_bytes=nil) @name, @start_bytes, @stop_bytes = name, start_bytes, stop_bytes @connections = [] @running = false end
Public Instance Methods
<<(conn)
click to toggle source
# File lib/patchmaster/patch.rb, line 13 def <<(conn) @connections << conn end
inputs()
click to toggle source
# File lib/patchmaster/patch.rb, line 17 def inputs @connections.map(&:input).uniq end
running?()
click to toggle source
# File lib/patchmaster/patch.rb, line 29 def running? @running end
start()
click to toggle source
Send start_bytes
to each connection.
# File lib/patchmaster/patch.rb, line 22 def start unless @running @connections.each { |conn| conn.start(@start_bytes) } @running = true end end
stop()
click to toggle source
Send stop_bytes
to each connection, then call stop
on each connection.
# File lib/patchmaster/patch.rb, line 34 def stop if @running @running = false @connections.each { |conn| conn.stop(@stop_bytes) } end end