Trans wrote:
> On Mar 2, 6:49 pm, Clifford Heath <n... / spam.please.net> wrote:
>> ...
>> # Print the difference between the before and after method lists:
>> before.keys.sort_by{|k| k.to_s}.each{|k|
>>     class_diff = after[k][0]-before[k][0]
>>     instance_diff = after[k][1]-before[k][1]
>>     next if class_diff.empty? && instance_diff.empty?
>>     puts((class_diff.sort.map{|c| "#{k}."+c} +
>>           instance_diff.sort.map{|c| "#{k}#"+c}
>>          )*"\n")
>>   }
> 
> Thanks for this, btw. I working on the next release of Facets, taking
> into consideration this entire conversation, and I'm using this code
> to ensure compatibility with ActiveSupport.

Glad to be able to help. Note that this code only detects added
methods, not changed ones, but since Facets doesn't change any
that shouldn't matter in this case. It would however be possible
to gather the actual Method objects into a hash and detect when
a name binds to a different Method object - to detect monkey
patching. Hmm, a new feature for "extensions.rb" :-)

Clifford Heath.