123456789_123456789_123456789_123456789_123456789_

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

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 482

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 486

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 498

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 491

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