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, lambda) ⇒ LambdaCallback

Returns a new instance of LambdaCallback.



30
31
32
33
34
# File 'lib/dnn/core/callbacks.rb', line 30

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