Class: EXEL::ListenInstruction

Inherits:
Object
  • Object
show all
Includes:
Events
Defined in:
lib/exel/listen_instruction.rb

Overview

Registers an event listener

Constant Summary

Constants included from Events

Events::LISTENERS_KEY

Instance Method Summary collapse

Methods included from Events

included, #register_listener, #trigger

Constructor Details

#initialize(event, listener) ⇒ ListenInstruction


10
11
12
13
# File 'lib/exel/listen_instruction.rb', line 10

def initialize(event, listener)
  @event = event
  @listener = listener
end

Instance Method Details

#execute(context) ⇒ Object


15
16
17
# File 'lib/exel/listen_instruction.rb', line 15

def execute(context)
  register_listener(context, @event, @listener)
end