class UserEvent attr_accessor :events def add_event(data) self.clear if self.events.nil? self.events << data end def get_events return self.events ||= [] end def clear self.events = [] end end