Class: Wright::Util::ErbRenderer Private
- Inherits:
-
Object
- Object
- Wright::Util::ErbRenderer
- Defined in:
- lib/wright/util/erb_renderer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
ERB renderer.
Instance Method Summary collapse
-
#initialize(hash) ⇒ ErbRenderer
constructor
private
A new instance of ErbRenderer.
-
#render(template) ⇒ String
private
Renders an ERB template.
Constructor Details
#initialize(hash) ⇒ ErbRenderer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ErbRenderer.
13 14 15 16 17 18 19 |
# File 'lib/wright/util/erb_renderer.rb', line 13 def initialize(hash) hash.each do |k, v| instance_var = "@#{k}" instance_variable_set(instance_var, v) define_singleton_method(k) { instance_variable_get(instance_var) } end end |
Instance Method Details
#render(template) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Renders an ERB template.
24 25 26 |
# File 'lib/wright/util/erb_renderer.rb', line 24 def render(template) ERB.new(template).result(binding) end |