Class: EMJack::BeanstalkConnection
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- EMJack::BeanstalkConnection
- Defined in:
- lib/em-jack/beanstalk_connection.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #connection_completed ⇒ Object
- #receive_data(data) ⇒ Object
- #send(command, *args) ⇒ Object
- #send_with_data(command, data, *args) ⇒ Object
- #unbind ⇒ Object
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/em-jack/beanstalk_connection.rb', line 5 def client @client end |
Instance Method Details
#connection_completed ⇒ Object
7 8 9 |
# File 'lib/em-jack/beanstalk_connection.rb', line 7 def connection_completed @client.connected end |
#receive_data(data) ⇒ Object
11 12 13 |
# File 'lib/em-jack/beanstalk_connection.rb', line 11 def receive_data(data) @client.received(data) end |
#send(command, *args) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/em-jack/beanstalk_connection.rb', line 15 def send(command, *args) cmd = command.to_s cmd << " #{args.join(" ")}" unless args.length == 0 cmd << "\r\n" send_data(cmd) end |
#send_with_data(command, data, *args) ⇒ Object
22 23 24 |
# File 'lib/em-jack/beanstalk_connection.rb', line 22 def send_with_data(command, data, *args) send_data("#{command.to_s} #{args.join(" ")}\r\n#{data}\r\n") end |
#unbind ⇒ Object
26 27 28 |
# File 'lib/em-jack/beanstalk_connection.rb', line 26 def unbind @client.disconnected end |