class <%= class_name %> class << self def generate greetings.sample end protected def greetings @greetings ||= load_txt_file 'greetings.txt' end private def load_txt_file file_name (File.readlines (File.join 'lib', file_name)).map &:strip end end end