module Tables class Table < Array attr_writer :discomfort attr_reader :id def initialize(*args) super @id = SecureRandom.uuid end def discomfort @discomfort ||= DiscomfortCalculator.new(self).calculate end def swap_candidates @swap_candidates ||= uniq { |person| person.affinity_group_list.first } end def dup super.tap do |new_table| new_table.discomfort = nil end end end end