From 9c30838abf1fd19b499ea9e396e9641806c3ba22 Mon Sep 17 00:00:00 2001 From: John Mettraux Date: Fri, 20 Jan 2023 09:41:26 +0900 Subject: [PATCH] Freeze constants, not the array they're splat from --- lib/fugit/duration.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fugit/duration.rb b/lib/fugit/duration.rb index d972266..bdc3420 100644 --- a/lib/fugit/duration.rb +++ b/lib/fugit/duration.rb @@ -68,8 +68,10 @@ def common_rewrite_dur(t) hou: { a: 'h', r: 'h', i: 'H', s: 3600, I: true, l: 'hour' }, min: { a: 'm', r: 'm', i: 'M', s: 60, I: true, l: 'minute' }, sec: { a: 's', r: 's', i: 'S', s: 1, I: true, l: 'second' } }.freeze - INFLA_KEYS, NON_INFLA_KEYS = - KEYS.partition { |k, v| v[:I] }.freeze + + INFLA_KEYS, NON_INFLA_KEYS = KEYS + .partition { |k, v| v[:I] } + .collect(&:freeze) def _to_s(key)