Class: Waves::Renderers::Erubis

Inherits:
Object
  • Object
show all
Includes:
Mixin
Defined in:
lib/renderers/erubis.rb

Class Method Summary collapse

Methods included from Mixin

included

Class Method Details

.render(path, assigns) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/renderers/erubis.rb', line 44

def self.render( path, assigns )
  eruby = ::Erubis::Eruby.new( template( path ) )
  helper = helper( path )
  context = ::Erubis::Context.new
  context.meta_eval { include( helper ) ; }
  context.instance_eval do
    assigns.each do |key,val|
      instance_variable_set("@#{key}",val)
    end
  end
  context.render(eruby)
end