From 95b3dc6550134630d4b2e973831cf48c9787f4b3 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 25 Jul 2024 20:33:15 -0400 Subject: [PATCH] Cache ItemSet#next_symbols - #28 --- lib/propane/parser/item_set.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/propane/parser/item_set.rb b/lib/propane/parser/item_set.rb index 2fe8403..eedaa34 100644 --- a/lib/propane/parser/item_set.rb +++ b/lib/propane/parser/item_set.rb @@ -46,7 +46,7 @@ class Propane # @return [Set] # Set of next symbols for all Items in this ItemSet. def next_symbols - Set.new(@items.map(&:next_symbol).compact) + @_next_symbols ||= Set.new(@items.map(&:next_symbol).compact) end # Build a next ItemSet for the given next symbol.