Tag Archives: singleton

Determining Singleton Class Status in Ruby

Q: How do you tell if a given class is an ordinary class or a singleton class? A: Test whether the class is the first element in its own ancestor list. class NotASingleton self == ancestors.first # => true end … Continue reading

Posted in Howto, Ruby | Tagged , , , | 2 Comments

Quickie Objects in Ruby

Sometimes you need a quick object one-off object. Maybe you’re writing a Fake Object that needs to mimic a subset of a real library’s functionality. Ruby provides several facilities which make it easy to throw together objects without the ceremony … Continue reading

Posted in Uncategorized | Tagged , | 4 Comments