方法
- E
- I
- M
- N
类公共方法
new(method) 链接
源代码: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/callbacks.rb, line 380 def initialize(method) @method_name = method end
实例公共方法
expand(target, value, block) 链接
返回执行此调用所需的各个部分,以及给定的输入值。
返回一个形式为
[target, block, method, *arguments]
此数组可以按以下方式使用
target.send(method, *arguments, &block)
实际的调用留给调用者来执行,以最大程度地减少调用堆栈污染。
源代码: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/callbacks.rb, line 397 def expand(target, value, block) [target, block, @method_name] end
inverted_lambda() 链接
源代码: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/callbacks.rb, line 407 def inverted_lambda lambda do |target, value, &block| !target.send(@method_name, &block) end end
make_lambda() 链接
源代码: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/callbacks.rb, line 401 def make_lambda lambda do |target, value, &block| target.send(@method_name, &block) end end