lib/liquid_dynamic_context/template_context.rb
# Given a liquid template string and any object you may want to dynamically
# assign as input to variables this method returns you a list of key/value
# pairs that contain the necessary bindings for your template.
#
# @param template_string [String] a valid liquid template
# @param models [Any] an object with dynamic data you want to
#   pass to your resolvers, can be nil
#
# @return [Hash<String,Any>] a hash with string keys that contains the bindings
#   for the template
Given a liquid template string and any object you may want to dynamically
assign as input to variables this method returns you a list of key/value
pairs that contain the necessary bindings for your template.
Given a liquid template string and any object you may want to dynamically assign as input to variables this method returns you a list of key / value pairs that contain the necessary bindings for your template .
def resolve(template_string, models)
      binding_resolvers.select { |resolver| resolver.needs_to_run?(variables(template_string)) }
                       .map { |resolver| resolver.call(models) }
                       .reduce({}, &:merge!)
    end
def resolve ( template_string , models ) binding_resolvers . select { | resolver | resolver . needs_to_run? ( variables ( template_string ) ) } . map { | resolver | resolver . call ( models ) } . reduce ( { } , & :merge! ) end
Given a liquid template string and any object you may want to dynamically
assign as input to variables this method returns you a list of key/value
pairs that contain the necessary bindings for your template.
Given a liquid template string and any object you may want to dynamically assign as input to variables this method returns you a list of key / value pairs that contain the necessary bindings for your template .
a hash with string keys that contains the bindings for the template
a hash with string keys that contains the bindings for the template
Hash<String,Any>
template_string
a valid liquid template
a valid liquid template
models
an object with dynamic data you want to pass to your resolvers, can be nil
an object with dynamic data you want to pass to your resolvers can be nil