Method: Tadpole::SectionProviders::ERBProvider#initialize
- Defined in:
- lib/tadpole/providers/erb.rb
#initialize(full_path, owner) ⇒ ERBProvider
Returns a new instance of ERBProvider.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tadpole/providers/erb.rb', line 8 def initialize(full_path, owner) super erb = ERB.new(content, nil, '<>') instance_eval(<<-eof, full_path, 1) def render(locals = nil, &block) if locals opts = owner.options owner.options = owner.options.to_hash.update(locals) end out = owner.instance_eval(#{erb.src.inspect}, __FILE__, __LINE__) owner.options = opts if locals out end eof end |