Skip to content

Commit ae0bf3b

Browse files
committed
Add #tell method to Context for convenience
allows to tell messages to self
1 parent 7d3d154 commit ae0bf3b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/concurrent/actor/context.rb

+11
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ def default_reference_class
7171
Reference
7272
end
7373

74+
def tell(message)
75+
reference.tell message
76+
end
77+
78+
def ask(message)
79+
raise 'actor cannot ask itself'
80+
end
81+
82+
alias_method :<<, :tell
83+
alias_method :ask!, :ask
84+
7485
private
7586

7687
def initialize_core(core)

0 commit comments

Comments
 (0)