Class: DNN::Callbacks::LambdaCallback

Inherits:
Callback
  • Object
show all
Defined in:
lib/dnn/core/callbacks.rb

Overview

This callback wrap the lambda function.

Instance Attribute Summary

Attributes inherited from Callback

#model

Instance Method Summary collapse

Constructor Details

#initialize(event) { ... } ⇒ LambdaCallback

Returns a new instance of LambdaCallback.

Parameters:

  • event (Symbol)

    Event to execute callback.

Yields:

  • Register the contents of the callback.



32
33
34
35
36
# File 'lib/dnn/core/callbacks.rb', line 32

def initialize(event, &block)
  instance_eval do
    define_singleton_method(event) { block.call }
  end
end