singleton.rb 222 B

1234567891011
  1. # Own implementation of the singleton pattern
  2. module Singleton
  3. # Returns the instance of the singleton
  4. def instance(*args)
  5. @instance ||= self.new(*args)
  6. return @instance
  7. end
  8. end
  9. end # modume Singleton