Sha256: 26a4b51d86139a088fe42b4703dd8172bbcd38e1e560bac875ab160c0263d106
Contents?: true
Size: 470 Bytes
Versions: 6
Compression:
Stored size: 470 Bytes
Contents
require 'liquid' module Conrefifier def self.file_variables(variables, path) return {} if variables.nil? data_vars = {} scopes = variables.select { |v| v[:scope][:path].empty? || Regexp.new(v[:scope][:path]) =~ path } scopes.each do |scope| data_vars = data_vars.merge(scope[:values]) end data_vars end def self.apply_liquid(content, data_vars) ::Liquid::Template.parse(content).render(data_vars.deep_stringify_keys) end end
Version data entries
6 entries across 6 versions & 1 rubygems