Class List Method List File List

# Class: VertxWeb::TemplateEngine

Inherits:
  Object
  - Object
  - VertxWeb::TemplateEngine
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/template_engine.rb

## Overview

A template engine uses a specific template and the data in a routing context to render a resource into a buffer.

Concrete implementations exist for several well-known template engines.

## Direct Known Subclasses

HandlebarsTemplateEngine, JadeTemplateEngine, MVELTemplateEngine, ThymeleafTemplateEngine

## Instance Method Summary (collapse)

- - (void) render(context = nil, templateFileName = nil) { ... }
  Render.

## Instance Method Details

### - (`void`) render(context = nil, templateFileName = nil) { ... }

This method returns an undefined value.

Render

Parameters:

- context (`::VertxWeb::RoutingContext`) (defaults to: `nil`) —
  the routing context
- templateFileName (`String`) (defaults to: `nil`) —
  the template file name to use

Yields:

- the handler that will be called with a result containing the buffer or a failure.

Raises:

- (`ArgumentError`)

    25
    26
    27
    28
    29
    30
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/src/main/resources/vertx-web/template_engine.rb', line 25

    def render(context=nil,templateFileName=nil)
      if context.class.method_defined?(:j_del) && templateFileName.class == String && block_given?
        return @j_del.java_method(:render, [Java::IoVertxExtWeb::RoutingContext.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(context.j_del,templateFileName,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Buffer) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling render(context,templateFileName)"
    end