class HydroponicBean::Connection
Attributes
waiting[RW]
waiting?[RW]
Public Class Methods
new()
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 10 def initialize @_read, @_write = IO.pipe @worker, @producer = false @waiting = false HydroponicBean.add_connection(self) end
Public Instance Methods
close()
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 39 def close @_read.close @_write.close HydroponicBean.remove_connection(self) end
closed?()
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 22 def closed? @_write.closed? end
producer!()
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 20 def producer!; @producer = true; end
producer?()
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 19 def producer?; @producer; end
read(bytes)
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 31 def read(bytes) @_read.read(bytes) end
readline()
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 35 def readline @_read.readline end
worker!()
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 18 def worker!; @worker = true; end
worker?()
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 17 def worker?; @worker; end
write(command)
click to toggle source
Necessary interface used by beaneater
# File lib/hydroponic_bean/connection.rb, line 27 def write(command) parse(StringIO.new(command)) end
Protected Instance Methods
output(data)
click to toggle source
# File lib/hydroponic_bean/connection.rb, line 46 def output(data) @_write.write(data) end