diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-10 11:50:50 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-10 11:50:50 -0700 |
commit | 40bdad34a5fb39cdd20887f498d4efeeae6d83c6 (patch) | |
tree | aefb6e2fdc2202da2b307e737f619c5603d0836d | |
parent | 17dfee0a991038ed0098309ddb4fd542f31dbf57 (diff) | |
download | rails-40bdad34a5fb39cdd20887f498d4efeeae6d83c6.tar.gz rails-40bdad34a5fb39cdd20887f498d4efeeae6d83c6.tar.bz2 rails-40bdad34a5fb39cdd20887f498d4efeeae6d83c6.zip |
rename instance variables
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index db86a532ff..0b7e73a5af 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -98,20 +98,22 @@ module ActiveSupport new chain, filter, kind, options, _klass end - attr_accessor :chain, :kind, :options, :klass, :raw_filter + attr_accessor :chain, :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) normalize_options!(options) - - @raw_filter, @options = filter, options - @key = compute_identifier filter end - def filter - @key - end + def filter; @key; end + def raw_filter; @filter; end def deprecate_per_key_option(options) if options[:per_key] @@ -143,7 +145,7 @@ module ActiveSupport end def duplicates?(other) - case @raw_filter + case @filter when Symbol, String matches?(other.kind, other.filter) else @@ -164,9 +166,9 @@ module ActiveSupport # Wraps code with filter def apply(next_callback) user_conditions = conditions_lambdas - user_callback = make_lambda @raw_filter + user_callback = make_lambda @filter - case @kind + case kind when :before halted_lambda = eval "lambda { |result| #{chain.config[:terminator]} }" lambda { |env| @@ -178,7 +180,7 @@ module ActiveSupport result = user_callback.call target, value env.halted = halted_lambda.call result if env.halted - target.send :halted_callback_hook, @raw_filter.inspect + target.send :halted_callback_hook, @filter.inspect end end next_callback.call env |