class GemeraldBeanstalk::Plugin::DirectConnection::Client
Attributes
beanstalk[R]
connection[R]
Public Class Methods
new(beanstalk)
click to toggle source
# File lib/gemerald_beanstalk/plugins/direct_connection/client.rb, line 13 def initialize(beanstalk) @beanstalk = beanstalk @connection = beanstalk.connect(self) @async_response = nil end
Public Instance Methods
close_connection()
click to toggle source
# File lib/gemerald_beanstalk/plugins/direct_connection/client.rb, line 6 def close_connection return unless connection.alive? connection.close_connection beanstalk.disconnect(self) end
send_data(message)
click to toggle source
# File lib/gemerald_beanstalk/plugins/direct_connection/client.rb, line 31 def send_data(message) @async_response = message end
transmit(message)
click to toggle source
# File lib/gemerald_beanstalk/plugins/direct_connection/client.rb, line 20 def transmit(message) message += "\r\n" unless message[-2, 2] == "\r\n" connection.execute(message) while (async_response = @async_response).nil? sleep 0.1 end @async_response = nil return async_response end