class Arrays::HashBlock

Public Instance Methods

parse(tokens) click to toggle source
Calls superclass method
# File lib/liquid-arrays/hash_block.rb, line 3
def parse(tokens)
  super
  parser = AttributeParser.new(@parse_context, 'hash', @markup)
  @hash_name = parser.consume_required_attribute('hash', :id)
  parser.finish
end
render(context) click to toggle source
Calls superclass method
# File lib/liquid-arrays/hash_block.rb, line 10
def render(context)
  if context.key?(@hash_name)
    @hash = context[@hash_name]
  else
    context.scopes.last[@hash_name] = @hash = {}
  end
  context.stack do
    context['block_hash'] = @hash
    @output = super
  end
  @output
end