Lazily Initialized Attribute

An attribute takes time to initialize but is only accessed rarely

Initialize when it's first used

class Employee
  def initialize
    @emails = []
  end
end 
  

image/svg+xml

class Employee
  def emails
    @emails ||= []
  end

  def voice_mails
    @voice_mails ||= []
  end
end   
  

inverse of Eagerly Initialized Attribute