Skip to content

Instantly share code, notes, and snippets.

@astroza
Created January 22, 2016 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astroza/213432022cdc4167ddd7 to your computer and use it in GitHub Desktop.
Save astroza/213432022cdc4167ddd7 to your computer and use it in GitHub Desktop.
lib/inspector.rb
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