Class: Rbgo::Actor
- Inherits:
-
Object
- Object
- Rbgo::Actor
- Defined in:
- lib/rbgo/actor.rb
Instance Attribute Summary collapse
-
#handler ⇒ Object
Returns the value of attribute handler.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(&handler) ⇒ Actor
constructor
A new instance of Actor.
- #send_msg(msg) ⇒ Object
Constructor Details
#initialize(&handler) ⇒ Actor
Returns a new instance of Actor.
14 15 16 17 18 |
# File 'lib/rbgo/actor.rb', line 14 def initialize(&handler) self.handler = handler self.mail_box = Queue.new start_msg_loop end |
Instance Attribute Details
#handler ⇒ Object
Returns the value of attribute handler.
12 13 14 |
# File 'lib/rbgo/actor.rb', line 12 def handler @handler end |
Instance Method Details
#close ⇒ Object
25 26 27 28 29 |
# File 'lib/rbgo/actor.rb', line 25 def close mail_box.close mail_box.clear nil end |
#closed? ⇒ Boolean
31 32 33 |
# File 'lib/rbgo/actor.rb', line 31 def closed? mail_box.closed? end |
#send_msg(msg) ⇒ Object
20 21 22 23 |
# File 'lib/rbgo/actor.rb', line 20 def send_msg(msg) mail_box << msg nil end |