Sha256: af5fbc6b4dc90858c63c9d310edc8f0ab974326e125e5b1d10e439e499be6c5a

Contents?: true

Size: 994 Bytes

Versions: 1

Compression:

Stored size: 994 Bytes

Contents

#!/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")
  }

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-2.4.0 script/conflicts