Sha256: deaa2ab2dd0ee895ab22b64acc22c91b9d961f26bab3a3819985daff8a406848
Contents?: true
Size: 497 Bytes
Versions: 24
Compression:
Stored size: 497 Bytes
Contents
module Liquid module CustomBlocks class WithYamlNestedContext < Block def initialize(tag_name, markup, tokens) super @context_file_variable, @context_name = markup.split(",").map(&:strip) end def render(context) context_file = context[@context_file_variable].to_s.strip context[@context_name] = YAML.safe_load( File.read(context_file, encoding: "utf-8"), [Date, Time] ) super end end end end
Version data entries
24 entries across 24 versions & 2 rubygems