Sha256: fbd1b9d81c84a40042295717bd4bc49b836cdc290fb554c34b85ea8704d77d34
Contents?: true
Size: 527 Bytes
Versions: 1
Compression:
Stored size: 527 Bytes
Contents
module Actors class Channel attr_reader :name, :subscribers def initialize(name) raise ArgumentError, "'name' should be an instance of Symbol" unless name.instance_of? Symbol @name = name @subscribers = TypedMap.new(ktype: Symbol, vtype: Actors::Actor) end def publish(message) raise ArgumentError, "'message' should be an instance of Hash" unless message.instance_of? Hash @subscribers.keys.each do |name| @subscribers[name].call message end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
actors-0.1.0 | lib/actors/channel.rb |