class Wisper::ObjectRegistration
Attributes
allowed_classes[R]
broadcaster[R]
prefix[R]
with[R]
Public Class Methods
new(listener, options)
click to toggle source
Calls superclass method
# File lib/wisper/registration/object.rb, line 7 def initialize(listener, options) super(listener, options) @with = options[:with] @prefix = ValueObjects::Prefix.new options[:prefix] @allowed_classes = Array(options[:scope]).map(&:to_s).to_set @broadcaster = map_broadcaster(options[:async] || options[:broadcaster]) end
Public Instance Methods
broadcast(event, publisher, *args)
click to toggle source
# File lib/wisper/registration/object.rb, line 15 def broadcast(event, publisher, *args) method_to_call = map_event_to_method(event) if should_broadcast?(event) && listener.respond_to?(method_to_call) && publisher_in_scope?(publisher) broadcaster.broadcast(listener, publisher, method_to_call, args) end end