lib/liquid_dynamic_context/variable_finder.rb
# Extracts all used variables from a liquid template.
#
# @param template_string [String] a string with a valid liquid template
#
# @return [Enumerable<Symbol>] an enumerable with the variables found in the template, the variables
#   are represented as symbols
Extracts all used variables from a liquid template.
Extracts all used variables from a liquid template .
def find_variables(template_string)
      parsed_template = Liquid::Template.parse(template_string)
      variable_lookups(parsed_template)
        .flatten
        .compact
        .map { |variable| variable.split(".").first }
        .map(&:to_sym)
        .uniq
    end
def find_variables ( template_string ) parsed_template = Liquid :: Template . parse ( template_string ) variable_lookups ( parsed_template ) . flatten . compact . map { | variable | variable . split ( "." ) . first } . map ( & :to_sym ) . uniq end
Extracts all used variables from a liquid template.
Extracts all used variables from a liquid template .
an enumerable with the variables found in the template, the variables are represented as symbols
an enumerable with the variables found in the template the variables are represented as symbols
Enumerable<Symbol>
template_string
a string with a valid liquid template
a string with a valid liquid template