Class: TreeRb::ErbRender
- Inherits:
-
Object
- Object
- TreeRb::ErbRender
- Includes:
- ERB::Util
- Defined in:
- lib/tree_rb/output_plugins/html/erb_render.rb
Instance Attribute Summary collapse
-
#json_str ⇒ Object
Returns the value of attribute json_str.
Instance Method Summary collapse
-
#initialize(template_name, json_str) ⇒ ErbRender
constructor
A new instance of ErbRender.
- #render ⇒ Object
Constructor Details
#initialize(template_name, json_str) ⇒ ErbRender
Returns a new instance of ErbRender.
8 9 10 11 |
# File 'lib/tree_rb/output_plugins/html/erb_render.rb', line 8 def initialize(template_name, json_str) @template_name = template_name @json_str = json_str end |
Instance Attribute Details
#json_str ⇒ Object
Returns the value of attribute json_str.
6 7 8 |
# File 'lib/tree_rb/output_plugins/html/erb_render.rb', line 6 def json_str @json_str end |
Instance Method Details
#render ⇒ Object
13 14 15 16 17 |
# File 'lib/tree_rb/output_plugins/html/erb_render.rb', line 13 def render() template_file_name = File.join(File.dirname(__FILE__), "templates", @template_name) template = File.read(template_file_name) ERB.new(template).result(binding) end |