123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::Callbacks::CallTemplate::InstanceExec2

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activesupport/lib/active_support/callbacks.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(block) ⇒ InstanceExec2

[ GitHub ]

  
# File 'activesupport/lib/active_support/callbacks.rb', line 440

def initialize(block)
  @override_block = block
end

Instance Method Details

#expand(target, value, block)

Raises:

  • (ArgumentError)
[ GitHub ]

  
# File 'activesupport/lib/active_support/callbacks.rb', line 444

def expand(target, value, block)
  raise ArgumentError unless block
  [target, @override_block || block, :instance_exec, target, block]
end

#inverted_lambda

[ GitHub ]

  
# File 'activesupport/lib/active_support/callbacks.rb', line 456

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

#make_lambda

[ GitHub ]

  
# File 'activesupport/lib/active_support/callbacks.rb', line 449

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