Class: EMJack::BeanstalkConnection

Inherits:
EM::Connection
  • Object
show all
Defined in:
lib/em-jack/beanstalk_connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject

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_completedObject



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

#unbindObject



26
27
28
# File 'lib/em-jack/beanstalk_connection.rb', line 26

def unbind
  @client.disconnected
end