Skip to content

Instantly share code, notes, and snippets.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@cowboyd
cowboyd / classmethod-inheritance.rb
Created January 19, 2012 21:28
Ruby classes inherit methods on singleton classes
# I never knew that singleton methods defined on a class are callable via subclasses
# Apparently when you create a subclass, that subclass's singleton class has
# its superclass's singleton class as an ancestor.
class Foo
@blip = 'foo'
def self.foo; @blip;end
end