Use a private constant to stash token-types

This commit is contained in:
Ashwin Maroli
2019-04-29 23:45:45 +05:30
parent b3b63a683f
commit 4684478e94
+4 -1
View File
@@ -44,11 +44,14 @@ module Liquid
tok[0] == type
end
CONSUME_TOKENS = [:string, :number]
private_constant :CONSUME_TOKENS
def expression
token = @tokens[@p]
if token[0] == :id
variable_signature
elsif [:string, :number].include? token[0]
elsif CONSUME_TOKENS.include? token[0]
consume
elsif token.first == :open_round
consume