class ActiveSupport::Callbacks::CallbackSequence
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/active_support/callbacks.rbs class ActiveSupport::Callbacks::CallbackSequence def before: () -> ActiveSupport::Callbacks::CallbackSequence def expand_call_template: (ActiveSupport::Callbacks::Filters::Environment arg, Proc block) -> untyped def final?: () -> untyped def invoke_after: (ActiveSupport::Callbacks::Filters::Environment arg) -> untyped end
:nodoc:
chaining them with nested lambda calls, see:
Execute before and after filters in a sequence instead of
def after(&after)
def after(&after) @after.push(after) self end
def around(call_template, user_conditions)
def around(call_template, user_conditions) CallbackSequence.new(self, call_template, user_conditions) end
def before(&before)
Experimental RBS support (using type sampling data from the type_fusion
project).
def before: () -> ActiveSupport::Callbacks::CallbackSequence
This signature was generated using 1 sample from 1 application.
def before(&before) @before.unshift(before) self end
def expand_call_template(arg, block)
Experimental RBS support (using type sampling data from the type_fusion
project).
def expand_call_template: (ActiveSupport::Callbacks::Filters::Environment arg, Proc block) -> untyped
This signature was generated using 1 sample from 1 application.
def expand_call_template(arg, block) @call_template.expand(arg.target, arg.value, block) end
def final?
Experimental RBS support (using type sampling data from the type_fusion
project).
def final?: () -> untyped
This signature was generated using 1 sample from 1 application.
def final? !@call_template end
def initialize(nested = nil, call_template = nil, user_conditions = nil)
https://github.com/rails/rails/issues/18011
chaining them with nested lambda calls, see:
Execute before and after filters in a sequence instead of
def initialize(nested = nil, call_template = nil, user_conditions = nil) @nested = nested @call_template = call_template @user_conditions = user_conditions @before = [] @after = [] end
def invoke_after(arg)
Experimental RBS support (using type sampling data from the type_fusion
project).
def invoke_after: (ActiveSupport::Callbacks::Filters::Environment arg) -> untyped
This signature was generated using 1 sample from 1 application.
def invoke_after(arg) @after.each { |a| a.call(arg) } end
def invoke_before(arg)
def invoke_before(arg) @before.each { |b| b.call(arg) } end
def skip?(arg)
def skip?(arg) arg.halted || !@user_conditions.all? { |c| c.call(arg.target, arg.value) } end