Number of classes and methods in a Rails project

A relatively small Rails project has

n_methods = 746703
n_unique_method_names = 2500
n_classes = 2500
avg_methods_per_class = 298
#
# n_methods = ObjectSpace.each_object(Class).map{|c| c.methods + c.private_methods}.flatten.count
# n_unique_method_names = ObjectSpace.each_object(Class).map{|c| c.methods + c.private_methods}.flatten.uniq.count
# n_classes = ObjectSpace.each_object(Class).count
# avg_methods_per_class = n_methods / n_classes
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s