Namespace Extlib versions of class_inheritable_accessor methods with extlib_prefix, as done in Wycats' Rails fork, so that their inclusion won't overwrite existing ActiveSupport implementations, if present. Check for existence of Class extensions on a per-method basis.

This commit is contained in:
Geoff Buesing 2009-03-19 12:50:58 -05:00 committed by Matt Aimonetti
parent de0476b083
commit a1a4985149
5 changed files with 148 additions and 222 deletions

View file

@ -426,10 +426,10 @@ module CouchRest
def define_callbacks(*symbols)
terminator = symbols.pop if symbols.last.is_a?(String)
symbols.each do |symbol|
self.class_inheritable_accessor("_#{symbol}_terminator")
self.extlib_inheritable_accessor("_#{symbol}_terminator")
self.send("_#{symbol}_terminator=", terminator)
self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
class_inheritable_accessor :_#{symbol}_callbacks
extlib_inheritable_accessor :_#{symbol}_callbacks
self._#{symbol}_callbacks = CallbackChain.new(:#{symbol})
def self.#{symbol}_callback(*filters, &blk)
@ -480,4 +480,4 @@ module CouchRest
end
end
end
end
end