Class: Conjur::WebServer::Renderer
- Inherits:
-
Object
- Object
- Conjur::WebServer::Renderer
- Defined in:
- lib/conjur/webserver/renderer.rb
Overview
a helper class to render HTML partials
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
-
#initialize(root) ⇒ Renderer
constructor
A new instance of Renderer.
- #render(template) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *a, &b) ⇒ Object (private)
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/conjur/webserver/renderer.rb', line 18 def method_missing name, *a, &b super if !a.empty? || block_given? # try to load fragments path = "_#{name}.html" super unless File.exists? path @files << path File.read path end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
10 11 12 |
# File 'lib/conjur/webserver/renderer.rb', line 10 def files @files end |
Instance Method Details
#render(template) ⇒ Object
12 13 14 |
# File 'lib/conjur/webserver/renderer.rb', line 12 def render template ERB.new(template).result binding end |