Class: Liquid::CustomBlocks::NestedContextBlock

Inherits:
Block
  • Object
show all
Defined in:
lib/liquid/custom_blocks/nested_context_block.rb

Direct Known Subclasses

WithJsonNestedContext, WithYamlNestedContext

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ NestedContextBlock

Returns a new instance of NestedContextBlock.



8
9
10
11
# File 'lib/liquid/custom_blocks/nested_context_block.rb', line 8

def initialize(tag_name, markup, tokens)
  super
  @context_file_variable, @context_name = markup.split(",").map(&:strip)
end

Instance Method Details

#render(context) ⇒ Object



13
14
15
16
17
# File 'lib/liquid/custom_blocks/nested_context_block.rb', line 13

def render(context)
  context_file = context[@context_file_variable].to_s.strip
  context[@context_name] = load_content(context_file)
  super
end