Class: Amp::Support::RawERbTemplate

Inherits:
Template
  • Object
show all
Defined in:
lib/amp-core/templates/template.rb

Overview

RawTemplate

Class for specifying a tiny bit of text to be interpreted as ERb code, and using that as a template.

Instance Attribute Summary

Attributes inherited from Template

#name, #renderer, #text

Instance Method Summary collapse

Methods inherited from Template

[], ensure_templates_loaded, load_default_templates, register, #render, templates_loaded?, unregister

Constructor Details

#initialize(text) ⇒ RawERbTemplate

Returns a new instance of RawERbTemplate.



170
171
172
173
# File 'lib/amp-core/templates/template.rb', line 170

def initialize(text)
  text = "<%= #{text} %>" unless text.include?("<%")
  super(:raw, "raw#{(rand * 65535).to_i}", :erb, text)
end