Skip to content

Instantly share code, notes, and snippets.

@benolee
Created November 8, 2013 01:32
Show Gist options
  • Save benolee/7364849 to your computer and use it in GitHub Desktop.
Save benolee/7364849 to your computer and use it in GitHub Desktop.
methods = Hash.new do |hash, klass|
klass.instance_methods.each do |mid|
m = klass.instance_method mid rescue next
hash[m.name] = [] unless hash.key? m.name
hash[m.name] |= [klass]
end
end
ObjectSpace.each_object(Class) do |klass|
methods[klass]
end
methods = methods.to_a.sort_by do |mid, klasses|
-klasses.count
end
require 'pp'
pp methods.
map { |mid, mods| [mid, mods.count] }.
select { |_, n| n > 1 }
__END__
[[:__id__, 254],
[:==, 254],
[:equal?, 254],
[:!, 254],
[:!=, 254],
[:__send__, 254],
[:instance_eval, 254],
[:instance_exec, 254],
[:!~, 253],
[:inspect, 253],
[:hash, 253],
[:eql?, 253],
[:send, 253],
[:enum_for, 253],
[:to_enum, 253],
[:object_id, 253],
[:define_singleton_method, 253],
[:public_send, 253],
[:to_s, 253],
[:public_method, 253],
[:method, 253],
[:display, 253],
[:extend, 253],
[:respond_to?, 253],
[:nil?, 253],
[:===, 253],
[:=~, 253],
[:tap, 253],
[:class, 253],
[:singleton_class, 253],
[:clone, 253],
[:dup, 253],
[:is_a?, 253],
[:tainted?, 253],
[:untaint, 253],
[:untrust, 253],
[:untrusted?, 253],
[:trust, 253],
[:freeze, 253],
[:frozen?, 253],
[:methods, 253],
[:singleton_methods, 253],
[:protected_methods, 253],
[:private_methods, 253],
[:public_methods, 253],
[:instance_variables, 253],
[:instance_variable_get, 253],
[:instance_variable_set, 253],
[:instance_variable_defined?, 253],
[:remove_instance_variable, 253],
[:instance_of?, 253],
[:kind_of?, 253],
[:taint, 253],
[:<=>, 252],
[:backtrace, 191],
[:exception, 190],
[:message, 190],
[:set_backtrace, 190],
[:errno, 132],
[:source_exception=, 19],
[:source_exception, 19],
[:to_a, 17],
[:include?, 15],
[:size, 14],
[:[], 13],
[:count, 13],
[:>, 13],
[:to_i, 13],
[:none?, 13],
[:>=, 13],
[:<, 13],
[:<=, 13],
[:min, 13],
[:partition, 13],
[:reverse_each, 12],
[:each_with_index, 12],
[:each_entry, 12],
[:member?, 12],
[:minmax_by, 12],
[:max_by, 12],
[:min_by, 12],
[:minmax, 12],
[:max, 12],
[:chunk, 12],
[:one?, 12],
[:any?, 12],
[:all?, 12],
[:first, 12],
[:group_by, 12],
[:cycle, 12],
[:reduce, 12],
[:inject, 12],
[:collect_concat, 12],
[:flat_map, 12],
[:map, 12],
[:collect, 12],
[:reject, 12],
[:select, 12],
[:find_all, 12],
[:find_index, 12],
[:detect, 12],
[:find, 12],
[:each_slice, 12],
[:grep, 12],
[:sort_by, 12],
[:sort, 12],
[:entries, 12],
[:each, 12],
[:drop_while, 12],
[:lazy, 12],
[:drop, 12],
[:zip, 12],
[:each_cons, 12],
[:take_while, 12],
[:each_with_object, 12],
[:take, 12],
[:slice_before, 12],
[:name, 11],
[:between?, 11],
[:to_r, 9],
[:to_c, 9],
[:zero?, 8],
[:to_f, 8],
[:+, 8],
[:path, 8],
[:singleton_method_added, 7],
[:real, 7],
[:round, 7],
[:imaginary, 7],
[:imag, 7],
[:-@, 7],
[:truncate, 7],
[:%, 7],
[:-, 7],
[:nonzero?, 7],
[:<<, 7],
[:integer?, 7],
[:to_int, 7],
[:+@, 7],
[:next, 7],
[:step, 7],
[:length, 7],
[:rationalize, 7],
[:&, 7],
[:rect, 7],
[:[]=, 7],
[:denominator, 7],
[:numerator, 7],
[:real?, 7],
[:conj, 7],
[:conjugate, 7],
[:polar, 7],
[:*, 7],
[:rectangular, 7],
[:phase, 7],
[:angle, 7],
[:arg, 7],
[:abs2, 7],
[:magnitude, 7],
[:abs, 7],
[:coerce, 7],
[:fdiv, 7],
[:quo, 7],
[:i, 6],
[:succ, 6],
[:rewind, 6],
[:floor, 6],
[:ceil, 6],
[:|, 6],
[:remainder, 6],
[:modulo, 6],
[:divmod, 6],
[:div, 6],
[:**, 5],
[:lineno, 5],
[:^, 5],
[:values_at, 5],
[:/, 5],
[:bytes, 5],
[:version, 5],
[:pos=, 4],
[:empty?, 4],
[:upto, 4],
[:chr, 4],
[:close, 4],
[:pos, 4],
[:seek, 4],
[:tell, 4],
[:read, 4],
[:ord, 4],
[:each_line, 4],
[:getbyte, 4],
[:each_byte, 4],
[:each_char, 4],
[:each_codepoint, 4],
[:lines, 4],
[:chars, 4],
[:codepoints, 4],
[:to_h, 4],
[:replace, 3],
[:lineno=, 3],
[:status, 3],
[:parameters, 3],
[:to_proc, 3],
[:read_nonblock, 3],
[:values, 3],
[:to_io, 3],
[:fileno, 3],
[:each_pair, 3],
[:gcdlcm, 3],
[:source_location, 3],
[:lcm, 3],
[:>>, 3],
[:pid, 3],
[:binmode, 3],
[:binmode?, 3],
[:success?, 3],
[:readpartial, 3],
[:write, 3],
[:gets, 3],
[:readline, 3],
[:getc, 3],
[:readchar, 3],
[:printf, 3],
[:gcd, 3],
[:ctime, 3],
[:puts, 3],
[:putc, 3],
[:readbyte, 3],
[:clear, 3],
[:arity, 3],
[:pretty_print, 3],
[:encode_with, 3],
[:external_encoding, 3],
[:internal_encoding, 3],
[:set_encoding, 3],
[:eof, 3],
[:readlines, 3],
[:eof?, 3],
[:yaml_initialize, 3],
[:pred, 3],
[:times, 3],
[:_dump, 3],
[:source_encoding, 3],
[:destination_encoding, 3],
[:downto, 3],
[:init_with, 3],
[:names, 3],
[:~, 3],
[:match, 3],
[:even?, 3],
[:encoding, 3],
[:odd?, 3],
[:index, 3],
[:closed?, 3],
[:slice, 3],
[:delete, 3],
[:print, 3],
[:keep_if, 2],
[:select!, 2],
[:reject!, 2],
[:delete_if, 2],
[:assoc, 2],
[:rassoc, 2],
[:flatten, 2],
[:concat, 2],
[:insert, 2],
[:rindex, 2],
[:reverse, 2],
[:reverse!, 2],
[:shift, 2],
[:slice!, 2],
[:fetch, 2],
[:source, 2],
[:destination_encoding_name, 2],
[:source_encoding_name, 2],
[:last, 2],
[:end, 2],
[:begin, 2],
[:bsearch, 2],
[:atime, 2],
[:stat, 2],
[:autoclose=, 2],
[:autoclose?, 2],
[:fcntl, 2],
[:mtime, 2],
[:reopen, 2],
[:owned?, 2],
[:to_path, 2],
[:binding, 2],
[:ioctl, 2],
[:advise, 2],
[:sysseek, 2],
[:tty?, 2],
[:eval, 2],
[:absolute_path, 2],
[:label, 2],
[:base_label, 2],
[:isatty, 2],
[:close_write, 2],
[:members, 2],
[:join, 2],
[:syswrite, 2],
[:sysread, 2],
[:to_str, 2],
[:fsync, 2],
[:version=, 2],
[:fdatasync, 2],
[:signo, 2],
[:signm, 2],
[:key?, 2],
[:keys, 2],
[:call, 2],
[:sync, 2],
[:sync=, 2],
[:write_nonblock, 2],
[:owner, 2],
[:ungetbyte, 2],
[:intern, 2],
[:to_sym, 2],
[:feed, 2],
[:peek, 2],
[:casecmp, 2],
[:peek_values, 2],
[:next_values, 2],
[:with_object, 2],
[:with_index, 2],
[:upcase, 2],
[:yield, 2],
[:downcase, 2],
[:requirements, 2],
[:capitalize, 2],
[:swapcase, 2],
[:included_modules, 2],
[:ancestors, 2],
[:instance_methods, 2],
[:public_instance_methods, 2],
[:protected_instance_methods, 2],
[:private_instance_methods, 2],
[:constants, 2],
[:const_get, 2],
[:const_set, 2],
[:const_defined?, 2],
[:const_missing, 2],
[:class_variables, 2],
[:remove_class_variable, 2],
[:class_variable_get, 2],
[:class_variable_set, 2],
[:class_variable_defined?, 2],
[:public_constant, 2],
[:private_constant, 2],
[:module_exec, 2],
[:class_exec, 2],
[:module_eval, 2],
[:class_eval, 2],
[:method_defined?, 2],
[:public_method_defined?, 2],
[:private_method_defined?, 2],
[:protected_method_defined?, 2],
[:public_class_method, 2],
[:private_class_method, 2],
[:autoload, 2],
[:autoload?, 2],
[:instance_method, 2],
[:name=, 2],
[:public_instance_method, 2],
[:wordy, 2],
[:ungetc, 2],
[:prerelease?, 2],
[:flush, 2],
[:to_yaml_properties, 2],
[:close_on_exec?, 2],
[:marshal_load, 2],
[:marshal_dump, 2],
[:close_on_exec=, 2],
[:close_read, 2]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment