2024-08-01 21:14:28 +02:00
|
|
|
module Tables
|
|
|
|
class Table < Array
|
2024-08-02 17:37:50 +02:00
|
|
|
attr_writer :discomfort
|
2024-08-02 18:17:22 +02:00
|
|
|
attr_reader :id
|
2024-08-02 17:37:50 +02:00
|
|
|
|
2024-08-01 21:14:28 +02:00
|
|
|
def initialize(*args)
|
|
|
|
super
|
|
|
|
reset
|
2024-08-02 18:17:22 +02:00
|
|
|
@id = SecureRandom.uuid
|
2024-08-01 21:14:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def reset
|
2024-08-02 17:37:50 +02:00
|
|
|
original_discomfort = @discomfort
|
2024-08-01 21:14:28 +02:00
|
|
|
@discomfort = nil
|
|
|
|
original_discomfort
|
|
|
|
end
|
2024-08-02 17:37:50 +02:00
|
|
|
|
|
|
|
def discomfort
|
|
|
|
@discomfort ||= DiscomfortCalculator.new(self).calculate
|
|
|
|
end
|
2024-08-01 21:14:28 +02:00
|
|
|
end
|
2024-08-02 17:37:50 +02:00
|
|
|
end
|