Skip to content

Commit

Permalink
More pruning of NewCallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehuda Katz authored and NZKoz committed Jun 9, 2009
1 parent e9a6255 commit 8cae3cd
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions activesupport/lib/active_support/new_callbacks.rb
Expand Up @@ -283,25 +283,14 @@ def _compile_filter(filter)
filter.map {|f| _compile_filter(f)}
when Symbol
filter
when String
"(#{filter})"
when Proc
@klass.send(:define_method, method_name, &filter)
method_name << case filter.arity
when 1
"(self)"
when 2
" self, Proc.new "
else
""
end
when String
@klass.class_eval <<-RUBY_EVAL
def #{method_name}
#{filter}
end
RUBY_EVAL
method_name
return method_name if filter.arity == 0

method_name << (filter.arity == 1 ? "(self)" : " self, Proc.new ")
else
kind = @kind
@klass.send(:define_method, "#{method_name}_object") { filter }

_normalize_legacy_filter(kind, filter)
Expand Down

0 comments on commit 8cae3cd

Please sign in to comment.