Skip to content

Instantly share code, notes, and snippets.

@dylanerichards
Created February 5, 2015 13:50
Show Gist options
  • Select an option

  • Save dylanerichards/1d53d177d957f0788741 to your computer and use it in GitHub Desktop.

Select an option

Save dylanerichards/1d53d177d957f0788741 to your computer and use it in GitHub Desktop.
Assigning Ruby Core Methods to People
people = %w(Umar Trevor Randy Marlone Gerardo Alex Isaac Conner)
methods = [
"String#count", "String#index", "String#rindex",
"String#gsub", "String#to_sym", "Hash#delete",
"Hash#delete_if", "Hash#each_key", "Hash#each_value",
"Hash#value?", "Hash#invert", "Hash#length",
"Hash#merge", "Hash#select", "Hash#to_a",
"Hash#values", "Hash#keys", "Array#compact",
"Array#delete", "Array#delete_at", "Array#delete_if",
"Array#insert", "Array#join", "Array#pop",
"Array#push", "Array#shift", "Array#uniq",
"Array#unshift", "Enumerable#include?", "Enumerable#sort",
"Enumerable#map", "Enumerable#collect",
]
shuffled_methods = methods.shuffle
split_shuffled_methods = shuffled_methods.each_slice(4).to_a
people.each do |person|
puts "#{person}: #{split_shuffled_methods.pop}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment