This method is deprecated or moved on the latest stable version.
The last existing version (v4.0.2) is shown here.
_compile_filter(filter)
private
Filters support:
Arrays::Usedinconditions.Thisisusedtospecifymultipleconditions.Usedinternallytomergeconditionsfromskip_*filters.Symbols::Amethodtocall.Strings::Somecontenttoevaluate.Procs::Aproctocallwiththeobject.Objects::Anobjectwitha<tt>before_foo</tt> method on it to call.
All of these objects are compiled into methods and handled the same after
this point:
Arrays::Mergedtogetherintoasinglefilter.Symbols::Alreadymethods.Strings::class_eval'ed into methods.
Procs:: define_method'edintomethods.Objects::amethodiscreatedthatcallsthebefore_foomethodontheobject.
# File activesupport/lib/active_support/callbacks.rb, line 259
def _compile_filter(filter)
case filter
when Array
filter.map {|f| _compile_filter(f)}
when Symbol
filter
when String
"(#{filter})"
when Proc
method_name = "_callback_#{@kind}_#{next_id}"
@klass.send(:define_method, method_name, &filter)
return method_name if filter.arity <= 0
method_name << (filter.arity == 1 ? "(self)" : " self, Proc.new ")
else
method_name = "_callback_#{@kind}_#{next_id}"
@klass.send(:define_method, "#{method_name}_object") { filter }
_normalize_legacy_filter(kind, filter)
scopes = Array(chain.config[:scope])
method_to_call = scopes.map{ |s| s.is_a?(Symbol) ? send(s) : s }.join("_")
@klass.class_eval def #{method_name}(&blk) #{method_name}_object.send(:#{method_to_call}, self, &blk) end, __FILE__, __LINE__ + 1
method_name
end
end