Class: Cliqr::Events::EventContext Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cliqr/events/event_context.rb

Overview

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.

The context in which event handlers are invoked

Instance Method Summary collapse

Constructor Details

#initialize(invoker, context, event) ⇒ EventContext

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.

Create a new event context to execute events



10
11
12
13
14
# File 'lib/cliqr/events/event_context.rb', line 10

def initialize(invoker, context, event)
  @invoker = invoker
  @context = context
  @event = event
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *_args, &_block) ⇒ 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.

Handle the case when a method is invoked to get an option value

Returns:

  • (Object)

    Option’s value



26
27
28
# File 'lib/cliqr/events/event_context.rb', line 26

def method_missing(name, *_args, &_block)
  @context.get_or_check_option(name)
end

Instance Method Details

#invoke(event_name, *args) ⇒ Boolean

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.

Invoke a event handler chain by name

Returns:

  • (Boolean)


19
20
21
# File 'lib/cliqr/events/event_context.rb', line 19

def invoke(event_name, *args)
  @invoker.invoke(event_name, @event, *args)
end