Class: Callbacker::Initiator

Inherits:
Object
  • Object
show all
Defined in:
lib/callbacker/initiator.rb

Overview

The Initiator class is used to create a callback that can be attached to a class that includes the Callbackable module.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Initiator

Initializes an instance of the class with the arguments that will be passed to the callback.

Parameters:

  • args (Hash)

    the arguments that will be passed to the callback.



15
16
17
# File 'lib/callbacker/initiator.rb', line 15

def initialize(**args)
  @args = args
end

Class Method Details

.callObject



6
7
8
# File 'lib/callbacker/initiator.rb', line 6

def call
  ->(**args) { new(**args).initiate }
end

Instance Method Details

#initiateObject

Performs the initiation of the callback.



20
21
22
# File 'lib/callbacker/initiator.rb', line 20

def initiate
  raise NotImplementedError 'You must implement the #initiate method.'
end