Class: ActiveSupport::Callbacks::CallTemplate::ProcCall

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

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ ProcCall

Returns a new instance of ProcCall.



507
508
509
# File 'lib/active_support/callbacks.rb', line 507

def initialize(target)
  @override_target = target
end

Instance Method Details

#expand(target, value, block) ⇒ Object



511
512
513
# File 'lib/active_support/callbacks.rb', line 511

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

#inverted_lambdaObject



521
522
523
524
525
# File 'lib/active_support/callbacks.rb', line 521

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

#make_lambdaObject



515
516
517
518
519
# File 'lib/active_support/callbacks.rb', line 515

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