Sha256: 9c5f370ea8b13259d65a7c894eb888c2750687f22432c6c594228c6e19e284c1
Contents?: true
Size: 703 Bytes
Versions: 2
Compression:
Stored size: 703 Bytes
Contents
module Concurrent module Actor module Utils module AsAdHoc def initialize(*args, &initializer) @on_message = Type! initializer.call(*args), Proc end def on_message(message) instance_exec message, &@on_message end end # Allows quick creation of actors with behaviour defined by blocks. # @example ping # AdHoc.spawn :forward, an_actor do |where| # # this block has to return proc defining #on_message behaviour # -> message { where.tell message } # end # @note TODO remove in favor of the module class AdHoc < Context include AsAdHoc end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
concurrent-ruby-edge-0.1.0.pre3 | lib/concurrent/actor/utils/ad_hoc.rb |
concurrent-ruby-edge-0.1.0.pre2 | lib/concurrent/actor/utils/ad_hoc.rb |