Class: Kangaru::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/kangaru/renderer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (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