Mega Code Archive

 
Categories / Ruby / Design Patterns
 

Define a singleton method, one that is tied to a single object

class Singleton end s = Singleton.new def s.handle   puts "I'm a singleton method!" end s.handle # => I'm a singleton method!