Class: Kangaru::Renderer
- Inherits:
-
Object
- Object
- Kangaru::Renderer
- Defined in:
- lib/kangaru/renderer.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ Renderer
constructor
A new instance of Renderer.
- #render(binding) ⇒ Object
Constructor Details
#initialize(path) ⇒ Renderer
Returns a new instance of Renderer.
5 6 7 |
# File 'lib/kangaru/renderer.rb', line 5 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/kangaru/renderer.rb', line 3 def path @path end |
Instance Method Details
#render(binding) ⇒ Object
9 10 11 12 13 |
# File 'lib/kangaru/renderer.rb', line 9 def render(binding) return unless path.exist? ERB.new(path.read, trim_mode: "-").run(binding) end |