#!/usr/bin/env ruby $: << 'lib' require 'enumerator' # Return a hash for each defined class containing a array of two arrays, # the first containing the class methods and the second the instance methods def methods_by_class Module. constants. map{|klass| eval(klass)}. select{|klass| klass.is_a? Class}. inject({}){|h,klass| h[klass] = [ klass.methods-klass.superclass.methods, klass.instance_methods-(klass.superclass ? klass.superclass.instance_methods : []) ] h } end before = methods_by_class ARGV.each{|a| require a } after = methods_by_class # 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") }