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.



38
39
40
41
42
# File 'lib/dnn/core/callbacks.rb', line 38

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