Class: Wisper::ObjectRegistration
- Inherits:
-
Registration
- Object
- Registration
- Wisper::ObjectRegistration
- Defined in:
- lib/wisper/registration/object.rb
Instance Attribute Summary collapse
-
#with ⇒ Object
readonly
Returns the value of attribute with.
Attributes inherited from Registration
Instance Method Summary collapse
- #broadcast(event, *args) ⇒ Object
-
#initialize(listener, options) ⇒ ObjectRegistration
constructor
A new instance of ObjectRegistration.
Constructor Details
#initialize(listener, options) ⇒ ObjectRegistration
Returns a new instance of ObjectRegistration.
5 6 7 8 9 |
# File 'lib/wisper/registration/object.rb', line 5 def initialize(listener, ) super(listener, ) @with = [:with] fail_on_async if .has_key?(:async) end |
Instance Attribute Details
#with ⇒ Object (readonly)
Returns the value of attribute with.
3 4 5 |
# File 'lib/wisper/registration/object.rb', line 3 def with @with end |
Instance Method Details
#broadcast(event, *args) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/wisper/registration/object.rb', line 11 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 |