Singleton pattern คือ pattern ที่จำกัดการสร้างอ็อบเจ็กต์ให้มีเพียง หนึ่งอินสแตนซ์เท่านั้น Ruby standard library มีโมดูล Singleton ให้ใช้งาน Singleton Pattern Code Example ทำให้ new เป็น private และสร้าง class method instance คืนค่าอินสแตนซ์เดียว: require singleton class Shop include Singleton end