Singleton Pattern MacRuby


/ Published in: Ruby
Save to your folder(s)

Works fine for MacRuby applications


Copy this code and paste it in your HTML
  1. class NewClass
  2. @@sharedController = nil
  3. def self.sharedController
  4. @@sharedController
  5. end
  6.  
  7. def initialize
  8. @@sharedController = self
  9. end
  10. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.