I'm Jason, a web application developer in East Tennessee.

Ruby Class Name

I noticed that in a module used on the CalCentral project that logger expressions used in a module referenced ‘’ many times. I checked for a reference to this class in the Ruby or Rails documentation, but I couldn’t find one. The module itself didn’t define a #name method, so I was perplexed.

The module I was inspecting is meant to be used to extend other classes, meaning that it establishes the methods as class methods. It turns out that the ‘Class’ class is officially documented as having a #name method that returns a string version of the class name. This is a valid way of logging which class the log message originates from.

comments powered by Disqus