Skip to content

Instantly share code, notes, and snippets.

@eggie5
Created November 3, 2016 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eggie5/21918365ba9bb2148d7d27c8540e6c13 to your computer and use it in GitHub Desktop.
Save eggie5/21918365ba9bb2148d7d27c8540e6c13 to your computer and use it in GitHub Desktop.
require 'singleton'
class World
include Singleton
attr_accessor :creatures
def initialize
self.creatures=[]
end
end
i=World.instance
i.creatures.push "Bulbasaur"
World.instance.creatures.push "Pickachu"
p i.creatures
# ["Bulbasaur", "Pickachu"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment