From f0e85641eea116d8a6c50a6973695c91214a8f18 Mon Sep 17 00:00:00 2001 From: Ricardo Trindade Date: Thu, 18 Apr 2024 17:13:16 +0200 Subject: [PATCH] Update persistence.rb compact is faster than looping with `reject` and achieves the same result --- lib/active_graph/shared/persistence.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_graph/shared/persistence.rb b/lib/active_graph/shared/persistence.rb index 131aca199..c661e443c 100644 --- a/lib/active_graph/shared/persistence.rb +++ b/lib/active_graph/shared/persistence.rb @@ -144,7 +144,7 @@ def destroyed? # @return [Hash] all defined and none nil properties def props - attributes.reject { |_, v| v.nil? }.symbolize_keys + attributes.compact.transform_keys(&:to_sym) end # @return true if the attributes hash has been frozen