Most used Ruby methods
I’ve done a quick script to scrape the base ruby methods and check their usage on Google Code Search — and the results for 800-odd ruby methods are at Github along with the source code.
Top five are #new, #each, #dirname (odd!), #join and #to_s with 784k total mentions in Google Code Search. Bottom five are #default_bindir, #yaml_tag_subclasses, #class_variable_defined?, #break_outmost_groups and #valid_jd? with whopping 0 total mentions.
Comments
dirname isn’t too surprising. It’s used a lot in big projects and libraries on requires.
require File.dirname(__FILE__) + "/whatever"And the like..
Hm, I wonder why
[]isn’t listed. I would’ve thought it’s used quite frequently.[] and methods like *, % or / were excluded from the search because, to conform with the template, it should have been called as .[], which does not occur too frequently.
Post a comment