From 18c318fff4d9cf68214db54c7a981eb8b7223114 Mon Sep 17 00:00:00 2001 From: Adam Harbinson Date: Tue, 12 Nov 2024 09:24:12 +0000 Subject: [PATCH] Fix breaking globs --- src/lucky_router/fragment.cr | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lucky_router/fragment.cr b/src/lucky_router/fragment.cr index 570a51d..8db368e 100644 --- a/src/lucky_router/fragment.cr +++ b/src/lucky_router/fragment.cr @@ -90,10 +90,8 @@ class LuckyRouter::Fragment(T) end def add_part(path_part : PathPart) : Fragment(T) - if glob_part = self.glob_part - return glob_part - elsif path_part.glob? - self.glob_part = Fragment(T).new(path_part: path_part) + if path_part.glob? + self.glob_part ||= Fragment(T).new(path_part: path_part) elsif path_part.path_variable? existing = self.dynamic_parts.find { |fragment| fragment.path_part == path_part } return existing if existing