Class: Tadpole::SectionProviders::ERBProvider
- Inherits:
-
SectionProvider
- Object
- SectionProvider
- Tadpole::SectionProviders::ERBProvider
- Defined in:
- lib/tadpole/providers/erb.rb
Constant Summary collapse
- EXTENSIONS =
['.erb']
Instance Attribute Summary
Attributes inherited from SectionProvider
Instance Method Summary collapse
-
#initialize(full_path, owner) ⇒ ERBProvider
constructor
A new instance of ERBProvider.
Methods inherited from SectionProvider
#inspect, #method_missing, path_suitable?, provides?, #render
Constructor Details
#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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Tadpole::SectionProviders::SectionProvider