Class: VertxWeb::TemplateEngine
- Inherits:
-
VertxWebCommon::TemplateEngine
- Object
- VertxWebCommon::TemplateEngine
- VertxWeb::TemplateEngine
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (true, false) caching_enabled?
Returns true if the template engine caches template files.
-
- (void) render(param_1 = nil, param_2 = nil, param_3 = nil)
Render the template NOTE if you call method directly (i.e. not using TemplateHandler) make sure that templateFileName is sanitized via.
Class Method Details
+ (Boolean) accept?(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/template_engine.rb', line 23 def @@j_api_type.accept?(obj) obj.class == TemplateEngine end |
+ (Object) j_api_type
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/template_engine.rb', line 32 def self.j_api_type @@j_api_type end |
+ (Object) j_class
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/template_engine.rb', line 35 def self.j_class Java::IoVertxExtWebTempl::TemplateEngine.java_class end |
+ (Object) unwrap(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/template_engine.rb', line 29 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/template_engine.rb', line 26 def @@j_api_type.wrap(obj) TemplateEngine.new(obj) end |
Instance Method Details
- (true, false) caching_enabled?
Returns true if the template engine caches template files. If false, then template files are freshly loaded each
time they are used.
69 70 71 72 73 74 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/template_engine.rb', line 69 def caching_enabled? if !block_given? return @j_del.java_method(:isCachingEnabled, []).call() end raise ArgumentError, "Invalid arguments when calling caching_enabled?()" end |
- (void) render(context, templateFileName, handler) { ... } - (void) render(context, templateFileName, handler) { ... } - (void) render(context, templateDirectory, templateFileName, handler) { ... }
This method returns an undefined value.
Render the templateNOTE if you call method directly (i.e. not using VertxWeb::TemplateHandler) make sure that templateFileName is sanitized via
56 57 58 59 60 61 62 63 64 65 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/template_engine.rb', line 56 def render(param_1=nil,param_2=nil,param_3=nil) if param_1.class == Hash && param_2.class == String && block_given? && param_3 == nil return @j_del.java_method(:render, [Java::IoVertxCoreJson::JsonObject.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(param_1),param_2,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Buffer) : nil) })) elsif param_1.class.method_defined?(:j_del) && param_2.class == String && block_given? && param_3 == nil return @j_del.java_method(:render, [Java::IoVertxExtWeb::RoutingContext.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,param_2,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Buffer) : nil) })) elsif param_1.class.method_defined?(:j_del) && param_2.class == String && param_3.class == String && block_given? return @j_del.java_method(:render, [Java::IoVertxExtWeb::RoutingContext.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,param_2,param_3,(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(#{param_1},#{param_2},#{param_3})" end |