Class: Shark::MailingService::Renderers::ErbRenderer
- Inherits:
-
Object
- Object
- Shark::MailingService::Renderers::ErbRenderer
- Defined in:
- lib/shark/mailing_service/renderers/erb_renderer.rb
Instance Attribute Summary collapse
-
#template_folder ⇒ Object
readonly
Returns the value of attribute template_folder.
Instance Method Summary collapse
-
#initialize(template_folder) ⇒ ErbRenderer
constructor
A new instance of ErbRenderer.
- #render(template, format, locals = {}) ⇒ Object
Constructor Details
#initialize(template_folder) ⇒ ErbRenderer
Returns a new instance of ErbRenderer.
11 12 13 |
# File 'lib/shark/mailing_service/renderers/erb_renderer.rb', line 11 def initialize(template_folder) @template_folder = template_folder end |
Instance Attribute Details
#template_folder ⇒ Object (readonly)
Returns the value of attribute template_folder.
9 10 11 |
# File 'lib/shark/mailing_service/renderers/erb_renderer.rb', line 9 def template_folder @template_folder end |
Instance Method Details
#render(template, format, locals = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/shark/mailing_service/renderers/erb_renderer.rb', line 15 def render(template, format, locals = {}) template = load_template(template, format) context = build_context(format, locals) ::ERB.new(template).result(context.binding) end |