Class: RubyWolf::Worker
- Inherits:
-
Object
- Object
- RubyWolf::Worker
- Defined in:
- lib/ruby_wolf/worker.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#connections ⇒ Object
readonly
Returns the value of attribute connections.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
Instance Method Summary collapse
-
#initialize(server) ⇒ Worker
constructor
A new instance of Worker.
- #start ⇒ Object
Constructor Details
#initialize(server) ⇒ Worker
Returns a new instance of Worker.
5 6 7 8 9 10 |
# File 'lib/ruby_wolf/worker.rb', line 5 def initialize(server) @server = server @app = server.app @socket = server.socket @connections = [] end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
3 4 5 |
# File 'lib/ruby_wolf/worker.rb', line 3 def app @app end |
#connections ⇒ Object (readonly)
Returns the value of attribute connections.
3 4 5 |
# File 'lib/ruby_wolf/worker.rb', line 3 def connections @connections end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
3 4 5 |
# File 'lib/ruby_wolf/worker.rb', line 3 def pid @pid end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
3 4 5 |
# File 'lib/ruby_wolf/worker.rb', line 3 def server @server end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
3 4 5 |
# File 'lib/ruby_wolf/worker.rb', line 3 def socket @socket end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 |
# File 'lib/ruby_wolf/worker.rb', line 12 def start @pid = fork do RubyWolf.log('Worker is ready') handle_loop end end |