diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-15 09:39:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-15 09:39:23 -0700 |
commit | db78643a17af9475fde2a6730e9e9e9fc3d77ad2 (patch) | |
tree | 42704052ae322803ec715099bffae7c2d3de2e0c /activesupport/lib | |
parent | 99f5add4be302a6b17f7098c1a9233a19de0fda4 (diff) | |
download | rails-db78643a17af9475fde2a6730e9e9e9fc3d77ad2.tar.gz rails-db78643a17af9475fde2a6730e9e9e9fc3d77ad2.tar.bz2 rails-db78643a17af9475fde2a6730e9e9e9fc3d77ad2.zip |
stop keeping a reference to the options hash
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index d4c18793ca..1a830c03b8 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -330,7 +330,7 @@ module ActiveSupport new chain.name, filter, kind, options, chain.config end - attr_accessor :kind, :options, :name + attr_accessor :kind, :name attr_reader :chain_config def initialize(name, filter, kind, options, chain_config) @@ -338,11 +338,11 @@ module ActiveSupport @name = name @kind = kind @filter = filter - @options = options @key = compute_identifier filter + @if = Array(options[:if]) + @unless = Array(options[:unless]) deprecate_per_key_option(options) - normalize_options!(options) end def filter; @key; end @@ -356,8 +356,8 @@ module ActiveSupport def merge(chain, new_options) _options = { - :if => @options[:if].dup, - :unless => @options[:unless].dup + :if => @if.dup, + :unless => @unless.dup } deprecate_per_key_option new_options @@ -368,11 +368,6 @@ module ActiveSupport self.class.build chain, @filter, @kind, _options end - def normalize_options!(options) - options[:if] = Array(options[:if]) - options[:unless] = Array(options[:unless]) - end - def matches?(_kind, _filter) @kind == _kind && filter == _filter end @@ -463,8 +458,8 @@ module ActiveSupport end def conditions_lambdas - options[:if].map { |c| make_lambda c } + - options[:unless].map { |c| invert_lambda make_lambda c } + @if.map { |c| make_lambda c } + + @unless.map { |c| invert_lambda make_lambda c } end def _normalize_legacy_filter(kind, filter) |