class Liquid::CustomBlocks::WithJsonNestedContext

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/liquid/custom_blocks/with_json_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_json_nested_context.rb, line 9
def render(context)
  context_file = context[@context_file_variable].to_s.strip
  context[@context_name] = JSON.parse(
    File.read(context_file, encoding: "utf-8")
  )
  super
end