Merge pull request #1099 from ashmaroli/stash-types-private-constant

Use a private constant to stash token-types
This commit is contained in:
Justin Li
2019-08-06 17:56:56 -04:00
committed by GitHub

View File

@@ -44,11 +44,14 @@ module Liquid
tok[0] == type
end
SINGLE_TOKEN_EXPRESSION_TYPES = [:string, :number].freeze
private_constant :SINGLE_TOKEN_EXPRESSION_TYPES
def expression
token = @tokens[@p]
if token[0] == :id
variable_signature
elsif [:string, :number].include? token[0]
elsif SINGLE_TOKEN_EXPRESSION_TYPES.include? token[0]
consume
elsif token.first == :open_round
consume