Class: Jace::Executer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/jace/executer.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.

Class responsible for executing a given block and triggering event

The event trigger has phase before and after so all methods are called before block execution and after, before returning the result

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(before: [], after: [], context:, &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.

Calls the execution

Parameters:

  • before (Symbol, Proc, Array) (defaults to: [])

    all the methods / proc to be executed before block call

  • after (Symbol, Proc, Array) (defaults to: [])

    all the methods / proc to be executed after block call

  • context (Object)

    Object where the procs / methods will be called on

Returns:

  • (Object)

    result of block call



23
24
25
# File 'lib/jace/executer.rb', line 23

def self.call(before: [], after: [], context:, &block)
  new(before, after, context, &block).call
end

Instance Method Details

#callObject

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.

calls the execution

Returns:

  • (Object)

    result of block call

See Also:



32
33
34
35
36
37
38
# File 'lib/jace/executer.rb', line 32

def call
  execute_actions(before)
  result = block.call if block
  execute_actions(after)

  result
end