Permalink
Browse files

push duplicates? logic to the instance

  • Loading branch information...
1 parent c5ed42a commit 17dfee0a991038ed0098309ddb4fd542f31dbf57 @tenderlove tenderlove committed May 10, 2013
Showing with 7 additions and 16 deletions.
  1. +7 −16 activesupport/lib/active_support/callbacks.rb
@@ -94,20 +94,8 @@ module Filters
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 @@ def matches?(_kind, _filter)
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)

0 comments on commit 17dfee0

Please sign in to comment.