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

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

Instance Method Summary collapse

Constructor Details

#initialize(target, method) ⇒ ObjectCall

Returns a new instance of ObjectCall.



373
374
375
376
# File 'lib/active_support/callbacks.rb', line 373

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

Instance Method Details

#expand(target, value, block) ⇒ Object



378
379
380
# File 'lib/active_support/callbacks.rb', line 378

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

#inverted_lambdaObject



388
389
390
391
392
# File 'lib/active_support/callbacks.rb', line 388

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

#make_lambdaObject



382
383
384
385
386
# File 'lib/active_support/callbacks.rb', line 382

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