Class: Arrays::HashBlock
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Arrays::HashBlock
- Defined in:
- lib/liquid-arrays/hash_block.rb
Instance Method Summary collapse
Instance Method Details
#parse(tokens) ⇒ Object
3 4 5 6 7 8 |
# 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) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# 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 |