Created
January 22, 2016 15:47
-
-
Save astroza/213432022cdc4167ddd7 to your computer and use it in GitHub Desktop.
lib/inspector.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Inspector | |
def inspect_objects_space | |
count = Hash.new(0) | |
ObjectSpace.each_object(Object) {|o| count[o.class] += 1 } | |
server = TCPSocket.new 'localhost', 51313 | |
max = count.reduce do |a, v| a[1] > v[1] ? a : v end | |
server.puts max.to_s | |
server.close | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment