Method: Liquid::Case#render

Defined in:
lib/liquid/tags/case.rb

#render(context) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/liquid/tags/case.rb', line 30

def render(context)      
  context.stack do          
    execute_else_block = true
    
    @blocks.inject([]) do |output, block|
  
      if block.else? 
        
        return render_all(block.attachment, context) if execute_else_block
        
      elsif block.evaluate(context)
        
        execute_else_block = false        
        output += render_all(block.attachment, context)                    
      end            
  
      output
    end
  end          
end