diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-10 11:45:48 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-10 11:45:48 -0700 |
commit | 17dfee0a991038ed0098309ddb4fd542f31dbf57 (patch) | |
tree | 960328b5adbb579e9d7723ceb191cbfe0ff98c73 /activesupport | |
parent | c5ed42a60281c24c34a0f7b28a72835a52ea7fc7 (diff) | |
download | rails-17dfee0a991038ed0098309ddb4fd542f31dbf57.tar.gz rails-17dfee0a991038ed0098309ddb4fd542f31dbf57.tar.bz2 rails-17dfee0a991038ed0098309ddb4fd542f31dbf57.zip |
push duplicates? logic to the instance
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index faa24d09de..db86a532ff 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -94,20 +94,8 @@ module ActiveSupport end class Callback #:nodoc:# - class Unduplicable < Callback # :nodoc: - def duplicates?(other) - false - end - end - def self.build(chain, filter, kind, options, _klass) - klass = case filter - when Symbol, String - Callback - else - Callback::Unduplicable - end - klass.new chain, filter, kind, options, _klass + new chain, filter, kind, options, _klass end attr_accessor :chain, :kind, :options, :klass, :raw_filter @@ -155,9 +143,12 @@ module ActiveSupport end def duplicates?(other) - return false unless self.class == other.class - - matches?(other.kind, other.filter) + case @raw_filter + when Symbol, String + matches?(other.kind, other.filter) + else + false + end end def _update_filter(filter_options, new_options) |