Sha256: 183cff8f516705b3680652cb0e57c30553d12373fef652a99c2218bf1059e65e
Contents?: true
Size: 650 Bytes
Versions: 3
Compression:
Stored size: 650 Bytes
Contents
module Wisper class ObjectRegistration < Registration attr_reader :with def initialize(listener, options) super(listener, options) @with = options[:with] fail_on_async if options.has_key?(:async) end def broadcast(event, *args) method_to_call = map_event_to_method(event) if should_broadcast?(event) && listener.respond_to?(method_to_call) listener.public_send(method_to_call, *args) end end private def map_event_to_method(event) with || event end def fail_on_async raise 'The async feature has been moved to the wisper-async gem' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wisper-1.2.1 | lib/wisper/registration/object.rb |
wisper-1.2.0 | lib/wisper/registration/object.rb |
wisper-1.1.0 | lib/wisper/registration/object.rb |