Class: ActiveSupport::Callbacks::CallTemplate::InstanceExec1

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

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ InstanceExec1

Returns a new instance of InstanceExec1.



458
459
460
# File 'activesupport/lib/active_support/callbacks.rb', line 458

def initialize(block)
  @override_block = block
end

Instance Method Details

#expand(target, value, block) ⇒ Object



462
463
464
# File 'activesupport/lib/active_support/callbacks.rb', line 462

def expand(target, value, block)
  [target, @override_block, :instance_exec, target]
end

#inverted_lambdaObject



472
473
474
475
476
# File 'activesupport/lib/active_support/callbacks.rb', line 472

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

#make_lambdaObject



466
467
468
469
470
# File 'activesupport/lib/active_support/callbacks.rb', line 466

def make_lambda
  lambda do |target, value, &block|
    target.instance_exec(target, &@override_block)
  end
end