mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
rename instance variables
This commit is contained in:
parent
17dfee0a99
commit
40bdad34a5
1 changed files with 14 additions and 12 deletions
|
@ -98,20 +98,22 @@ module ActiveSupport
|
||||||
new chain, filter, kind, options, _klass
|
new chain, filter, kind, options, _klass
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :chain, :kind, :options, :klass, :raw_filter
|
attr_accessor :chain, :kind, :options, :klass
|
||||||
|
|
||||||
def initialize(chain, filter, kind, options, klass)
|
def initialize(chain, filter, kind, options, klass)
|
||||||
@chain, @kind, @klass = chain, kind, klass
|
@chain = chain
|
||||||
|
@kind = kind
|
||||||
|
@klass = klass
|
||||||
|
@filter = filter
|
||||||
|
@options = options
|
||||||
|
@key = compute_identifier filter
|
||||||
|
|
||||||
deprecate_per_key_option(options)
|
deprecate_per_key_option(options)
|
||||||
normalize_options!(options)
|
normalize_options!(options)
|
||||||
|
|
||||||
@raw_filter, @options = filter, options
|
|
||||||
@key = compute_identifier filter
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter
|
def filter; @key; end
|
||||||
@key
|
def raw_filter; @filter; end
|
||||||
end
|
|
||||||
|
|
||||||
def deprecate_per_key_option(options)
|
def deprecate_per_key_option(options)
|
||||||
if options[:per_key]
|
if options[:per_key]
|
||||||
|
@ -143,7 +145,7 @@ module ActiveSupport
|
||||||
end
|
end
|
||||||
|
|
||||||
def duplicates?(other)
|
def duplicates?(other)
|
||||||
case @raw_filter
|
case @filter
|
||||||
when Symbol, String
|
when Symbol, String
|
||||||
matches?(other.kind, other.filter)
|
matches?(other.kind, other.filter)
|
||||||
else
|
else
|
||||||
|
@ -164,9 +166,9 @@ module ActiveSupport
|
||||||
# Wraps code with filter
|
# Wraps code with filter
|
||||||
def apply(next_callback)
|
def apply(next_callback)
|
||||||
user_conditions = conditions_lambdas
|
user_conditions = conditions_lambdas
|
||||||
user_callback = make_lambda @raw_filter
|
user_callback = make_lambda @filter
|
||||||
|
|
||||||
case @kind
|
case kind
|
||||||
when :before
|
when :before
|
||||||
halted_lambda = eval "lambda { |result| #{chain.config[:terminator]} }"
|
halted_lambda = eval "lambda { |result| #{chain.config[:terminator]} }"
|
||||||
lambda { |env|
|
lambda { |env|
|
||||||
|
@ -178,7 +180,7 @@ module ActiveSupport
|
||||||
result = user_callback.call target, value
|
result = user_callback.call target, value
|
||||||
env.halted = halted_lambda.call result
|
env.halted = halted_lambda.call result
|
||||||
if env.halted
|
if env.halted
|
||||||
target.send :halted_callback_hook, @raw_filter.inspect
|
target.send :halted_callback_hook, @filter.inspect
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next_callback.call env
|
next_callback.call env
|
||||||
|
|
Loading…
Reference in a new issue