Skip to content

Instantly share code, notes, and snippets.

@craigw
Forked from codahale/gist:70417
Created February 25, 2009 21:24
Show Gist options
  • Save craigw/70422 to your computer and use it in GitHub Desktop.
Save craigw/70422 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Let's just worry about what's done to Array directly, and not the insanity
# in any of the parent classes.
$existing_methods = []
def print_methods(library)
new_methods = ([].methods.sort - [].class.superclass.methods.sort) - $existing_methods
for method in new_methods
puts "Array##{method}"
end
puts "(total: #{new_methods.size} added by #{library})\n\n"
$existing_methods = [].methods.sort - [].class.superclass.methods.sort
end
"Standard: ===================================================================="
print_methods("stdlib")
"RubyGems: ===================================================================="
require "rubygems"
print_methods("rubygems")
"ActiveSupport: ==============================================================="
require "activesupport"
print_methods("activesupport")
Array#&
Array#*
Array#+
Array#-
Array#<<
Array#[]
Array#[]=
Array#all?
Array#any?
Array#assoc
Array#at
Array#clear
Array#collect
Array#collect!
Array#compact
Array#compact!
Array#concat
Array#delete
Array#delete_at
Array#delete_if
Array#detect
Array#each
Array#each_index
Array#each_with_index
Array#empty?
Array#entries
Array#fetch
Array#fill
Array#find
Array#find_all
Array#first
Array#flatten
Array#flatten!
Array#grep
Array#index
Array#indexes
Array#indices
Array#inject
Array#insert
Array#join
Array#last
Array#length
Array#map
Array#map!
Array#max
Array#member?
Array#min
Array#nitems
Array#pack
Array#partition
Array#pop
Array#push
Array#rassoc
Array#reject
Array#reject!
Array#replace
Array#reverse
Array#reverse!
Array#reverse_each
Array#rindex
Array#select
Array#shift
Array#size
Array#slice
Array#slice!
Array#sort
Array#sort!
Array#sort_by
Array#to_ary
Array#transpose
Array#uniq
Array#uniq!
Array#unshift
Array#values_at
Array#zip
Array#|
(total: 76 added by stdlib)
(total: 0 added by rubygems)
Array#each_cons
Array#each_slice
Array#each_with_object
Array#enum_cons
Array#enum_slice
Array#enum_with_index
Array#extract_options!
Array#fifth
Array#forty_two
Array#fourth
Array#from
Array#group_by
Array#in_groups
Array#in_groups_of
Array#index_by
Array#many?
Array#rand
Array#second
Array#split
Array#sum
Array#third
Array#to
Array#to_default_s
Array#to_formatted_s
Array#to_sentence
Array#to_set
Array#to_xml
Array#yaml_initialize
(total: 28 added by activesupport)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment