From 283f1bad18752ae4fa78d697dcfe6af87088647e Mon Sep 17 00:00:00 2001 From: Michael Angell Date: Fri, 8 Jul 2016 20:49:30 +1000 Subject: [PATCH] Use .last instead of pop push method for updating last node in nodelist --- lib/liquid/block_body.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/liquid/block_body.rb b/lib/liquid/block_body.rb index 89cb6d8..00811c1 100644 --- a/lib/liquid/block_body.rb +++ b/lib/liquid/block_body.rb @@ -56,10 +56,9 @@ module Liquid def whitespace_handler(token, parse_context) if token[2] == WhitespaceControl - previous_token = @nodelist.pop + previous_token = @nodelist.last if previous_token.is_a? String previous_token.rstrip! - @nodelist << previous_token end end parse_context.trim_whitespace = (token[-3] == WhitespaceControl)