module Ably::Modules::EventEmitter::ClassMethods

Attributes

event_emitter_coerce_proc[R]

Public Instance Methods

configure_event_emitter(options = {}) click to toggle source

Configure included EventEmitter

@param [Hash] options the options for the {EventEmitter} @option options [Proc] :coerce_into A lambda/Proc that is used to coerce the event names for all events. This is useful to ensure the event names conform to a naming or type convention.

@example

configure_event_emitter coerce_into: lambda { |event| event.to_sym }
# File lib/submodules/ably-ruby/lib/ably/modules/event_emitter.rb, line 36
def configure_event_emitter(options = {})
  @event_emitter_coerce_proc = options[:coerce_into]
end
inherited(subclass) click to toggle source

Ensure @event_emitter_coerce_proc option is passed down to any classes that inherit the class with callbacks

Calls superclass method
# File lib/submodules/ably-ruby/lib/ably/modules/event_emitter.rb, line 41
def inherited(subclass)
  subclass.instance_variable_set('@event_emitter_coerce_proc', @event_emitter_coerce_proc) if defined?(@event_emitter_coerce_proc)
  super
end