# File lib/liquid/template.rb, line 85
    def render(*args)
      return '' if @root.nil?                          

      context = case args.first
      when Liquid::Context
        args.shift
      when Hash
        self.assigns.merge!(args.shift)        
        Context.new(assigns, registers, @rethrow_errors)
      when nil
        Context.new(assigns, registers, @rethrow_errors)
      else
        raise ArgumentError, "Expect Hash or Liquid::Context as parameter"
      end
      
      case args.last
      when Hash
        options = args.pop
        
        if options[:registers].is_a?(Hash)
          self.registers.merge!(options[:registers])  
        end

        if options[:filters]
          context.add_filters(options[:filters])
        end                         
        
      when Module
        context.add_filters(args.pop)    
      when Array
        context.add_filters(args.pop)            
      end
                                                            
      begin
        # render the nodelist.
        # for performance reasons we get a array back here. join will make a string out of it
        @root.render(context).join
      ensure
        @errors = context.errors
      end
    end