lib/concurrent/actress/context.rb in concurrent-ruby-0.6.0 vs lib/concurrent/actress/context.rb in concurrent-ruby-0.6.1

- old
+ new

@@ -1,9 +1,10 @@ module Concurrent module Actress - # module used to define actor behaviours + # This module is used to define actors. It can be included in any class, + # only requirement is to override {Context#on_message} method. # @example ping # class Ping # include Context # def on_message(message) # message @@ -24,14 +25,10 @@ # instead def on_message(message) raise NotImplementedError end - def logger - core.logger - end - # @api private def on_envelope(envelope) @envelope = envelope on_message envelope.message ensure @@ -51,13 +48,18 @@ # @see Core#terminate! def terminate! core.terminate! end + # delegates to core.log + # @see Logging#log + def log(level, progname, message = nil, &block) + core.log(level, progname, message, &block) + end + private - # @api private def initialize_core(core) @core = Type! core, Core end # @return [Envelope] current envelope, accessible inside #on_message processing @@ -69,15 +71,15 @@ base.extend ClassMethods super base end module ClassMethods - # behaves as {Actress.spawn} but class_name is omitted + # behaves as {Concurrent::Actress.spawn} but class_name is auto-inserted based on receiver def spawn(name_or_opts, *args, &block) Actress.spawn spawn_optionify(name_or_opts, *args), &block end - # behaves as {Actress.spawn!} but class_name is omitted + # behaves as {Concurrent::Actress.spawn!} but class_name is auto-inserted based on receiver def spawn!(name_or_opts, *args, &block) Actress.spawn! spawn_optionify(name_or_opts, *args), &block end private