Class: Packet::Pimp
- Inherits:
-
Object
- Object
- Packet::Pimp
- Extended by:
- Forwardable, ClassHelpers
- Includes:
- NbioHelper
- Defined in:
- lib/packet/packet_pimp.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#fd_write_end ⇒ Object
Returns the value of attribute fd_write_end.
-
#lifeline ⇒ Object
Returns the value of attribute lifeline.
-
#outbound_data ⇒ Object
Returns the value of attribute outbound_data.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#reactor ⇒ Object
Returns the value of attribute reactor.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#workers ⇒ Object
Returns the value of attribute workers.
Instance Method Summary collapse
-
#initialize(lifeline_socket, worker_pid, p_reactor) ⇒ Pimp
constructor
A new instance of Pimp.
-
#send_data(p_data) ⇒ Object
(also: #do_work)
encode the data, before writing to the socket.
- #send_fd(sock_fd) ⇒ Object
Methods included from ClassHelpers
iattr_accessor, inheritable_attribute, metaclass
Methods included from NbioHelper
#dump_object, #gen_worker_key, #object_dump, #packet_classify, #read_data, #write_and_schedule, #write_once
Constructor Details
#initialize(lifeline_socket, worker_pid, p_reactor) ⇒ Pimp
Returns a new instance of Pimp.
11 12 13 14 15 16 17 18 |
# File 'lib/packet/packet_pimp.rb', line 11 def initialize(lifeline_socket,worker_pid,p_reactor) @lifeline = lifeline_socket @pid = worker_pid @reactor = p_reactor @signature = Guid.hexdigest @outbound_data = [] pimp_init if self.respond_to?(:pimp_init) end |
Instance Attribute Details
#fd_write_end ⇒ Object
Returns the value of attribute fd_write_end.
8 9 10 |
# File 'lib/packet/packet_pimp.rb', line 8 def fd_write_end @fd_write_end end |
#lifeline ⇒ Object
Returns the value of attribute lifeline.
7 8 9 |
# File 'lib/packet/packet_pimp.rb', line 7 def lifeline @lifeline end |
#outbound_data ⇒ Object
Returns the value of attribute outbound_data.
9 10 11 |
# File 'lib/packet/packet_pimp.rb', line 9 def outbound_data @outbound_data end |
#pid ⇒ Object
Returns the value of attribute pid.
7 8 9 |
# File 'lib/packet/packet_pimp.rb', line 7 def pid @pid end |
#reactor ⇒ Object
Returns the value of attribute reactor.
9 10 11 |
# File 'lib/packet/packet_pimp.rb', line 9 def reactor @reactor end |
#signature ⇒ Object
Returns the value of attribute signature.
7 8 9 |
# File 'lib/packet/packet_pimp.rb', line 7 def signature @signature end |
#workers ⇒ Object
Returns the value of attribute workers.
9 10 11 |
# File 'lib/packet/packet_pimp.rb', line 9 def workers @workers end |
Instance Method Details
#send_data(p_data) ⇒ Object Also known as: do_work
encode the data, before writing to the socket
21 22 23 |
# File 'lib/packet/packet_pimp.rb', line 21 def send_data p_data dump_object(p_data,@lifeline) end |
#send_fd(sock_fd) ⇒ Object
25 26 27 |
# File 'lib/packet/packet_pimp.rb', line 25 def send_fd sock_fd @fd_write_end.send_io(sock_fd) end |