From 54975ddac177e8423356b15da86bb752f9d0fd6d Mon Sep 17 00:00:00 2001 From: Michael Go Date: Thu, 24 Oct 2024 23:00:34 -0300 Subject: [PATCH] more micro optimization --- lib/liquid/tokenizer.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/liquid/tokenizer.rb b/lib/liquid/tokenizer.rb index 2d79dde5..71541f71 100644 --- a/lib/liquid/tokenizer.rb +++ b/lib/liquid/tokenizer.rb @@ -49,6 +49,16 @@ module Liquid end def next_token + if @ss.pos == 0 + if @ss.string.start_with?("{{") + return next_variable_token + elsif @ss.string.start_with?("{%") + return next_tag_token + else + return next_text_token + end + end + # possible states: :text, :tag, :variable byte_a = @ss.scan_byte