Sha256: 6133ae57104c5d9834c71c2dc444904ffb785c03d496ffd8dec95bece53e5c4c
Contents?: true
Size: 465 Bytes
Versions: 3
Compression:
Stored size: 465 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].stringify_keys) end data_vars end def self.apply_liquid(content, data_vars) ::Liquid::Template.parse(content).render(data_vars) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nanoc-conref-fs-0.4.1 | lib/nanoc-conref-fs/conrefifier.rb |
nanoc-conref-fs-0.4.0 | lib/nanoc-conref-fs/conrefifier.rb |
nanoc-conref-fs-0.3.1 | lib/nanoc-conref-fs/conrefifier.rb |