class Liquid::CustomBlocks::WithYamlNestedContext

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/liquid/custom_blocks/with_yaml_nested_context.rb, line 4
def initialize(tag_name, markup, tokens)
  super
  @context_file_variable, @context_name = markup.split(",").map(&:strip)
end

Public Instance Methods

render(context) click to toggle source
Calls superclass method
# File lib/liquid/custom_blocks/with_yaml_nested_context.rb, line 9
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],
    [],
    true
  )
  super
end