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

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

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ ProcCall

Returns a new instance of ProcCall.



505
506
507
# File 'activesupport/lib/active_support/callbacks.rb', line 505

def initialize(target)
  @override_target = target
end

Instance Method Details

#expand(target, value, block) ⇒ Object



509
510
511
# File 'activesupport/lib/active_support/callbacks.rb', line 509

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

#inverted_lambdaObject



519
520
521
522
523
# File 'activesupport/lib/active_support/callbacks.rb', line 519

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

#make_lambdaObject



513
514
515
516
517
# File 'activesupport/lib/active_support/callbacks.rb', line 513

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