Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

stop keeping a reference to the options hash

  • Loading branch information...
commit db78643a17af9475fde2a6730e9e9e9fc3d77ad2 1 parent 99f5add
@tenderlove tenderlove authored
Showing with 7 additions and 12 deletions.
  1. +7 −12 activesupport/lib/active_support/callbacks.rb
View
19 activesupport/lib/active_support/callbacks.rb
@@ -330,7 +330,7 @@ def self.build(chain, filter, kind, options)
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 @@ def initialize(name, filter, kind, options, chain_config)
@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 @@ def deprecate_per_key_option(options)
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 @@ def merge(chain, new_options)
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 @@ def compute_identifier(filter)
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)
Please sign in to comment.
Something went wrong with that request. Please try again.