Class: ActiveSupport::Callbacks::CallTemplate::ObjectCall

Inherits:
Object
  • Object
show all
Defined in:
activesupport/lib/active_support/callbacks.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, method) ⇒ ObjectCall

Returns a new instance of ObjectCall.



413
414
415
416
# File 'activesupport/lib/active_support/callbacks.rb', line 413

def initialize(target, method)
  @override_target = target
  @method_name = method
end

Instance Method Details

#expand(target, value, block) ⇒ Object



418
419
420
# File 'activesupport/lib/active_support/callbacks.rb', line 418

def expand(target, value, block)
  [@override_target || target, block, @method_name, target]
end

#inverted_lambdaObject



428
429
430
431
432
# File 'activesupport/lib/active_support/callbacks.rb', line 428

def inverted_lambda
  lambda do |target, value, &block|
    !(@override_target || target).send(@method_name, target, &block)
  end
end

#make_lambdaObject



422
423
424
425
426
# File 'activesupport/lib/active_support/callbacks.rb', line 422

def make_lambda
  lambda do |target, value, &block|
    (@override_target || target).send(@method_name, target, &block)
  end
end