Class: Wisper::ObjectRegistration Private
- Inherits:
-
Registration
- Object
- Registration
- Wisper::ObjectRegistration
- Defined in:
- lib/wisper/registration/object.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #allowed_classes ⇒ Object readonly private
- #broadcaster ⇒ Object readonly private
- #prefix ⇒ Object readonly private
- #with ⇒ Object readonly private
Attributes inherited from Registration
Instance Method Summary collapse
- #broadcast(event, publisher, *args, **kwargs) ⇒ Object private
-
#initialize(listener, **options) ⇒ ObjectRegistration
constructor
private
A new instance of ObjectRegistration.
Constructor Details
#initialize(listener, **options) ⇒ ObjectRegistration
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ObjectRegistration.
7 8 9 10 11 12 13 |
# File 'lib/wisper/registration/object.rb', line 7 def initialize(listener, **) super(listener, **) @with = [:with] @prefix = ValueObjects::Prefix.new [:prefix] @allowed_classes = Array([:scope]).map(&:to_s).to_set @broadcaster = map_broadcaster([:async] || [:broadcaster]) end |
Instance Attribute Details
#allowed_classes ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/wisper/registration/object.rb', line 5 def allowed_classes @allowed_classes end |
#broadcaster ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/wisper/registration/object.rb', line 5 def broadcaster @broadcaster end |
#prefix ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/wisper/registration/object.rb', line 5 def prefix @prefix end |
#with ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/wisper/registration/object.rb', line 5 def with @with end |
Instance Method Details
#broadcast(event, publisher, *args, **kwargs) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 19 20 |
# File 'lib/wisper/registration/object.rb', line 15 def broadcast(event, publisher, *args, **kwargs) 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, **kwargs) end end |