Class: Tadpole::SectionProviders::HamlProvider

Inherits:
SectionProvider show all
Defined in:
lib/tadpole/providers/haml.rb

Constant Summary collapse

EXTENSIONS =
['.haml']

Instance Attribute Summary

Attributes inherited from SectionProvider

#content, #full_path, #owner

Instance Method Summary collapse

Methods inherited from SectionProvider

#inspect, #method_missing, path_suitable?, provides?

Constructor Details

#initialize(full_path, owner) ⇒ HamlProvider

Returns a new instance of HamlProvider.



8
9
10
11
12
13
14
# File 'lib/tadpole/providers/haml.rb', line 8

def initialize(full_path, owner)
  super
  @haml = Haml::Engine.new(content)
rescue NameError => e
  STDERR.puts "You're missing Haml! Install the gem with `gem install haml`."
  exit
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Tadpole::SectionProviders::SectionProvider

Instance Method Details

#render(locals = {}, &block) ⇒ Object



16
17
18
# File 'lib/tadpole/providers/haml.rb', line 16

def render(locals = {}, &block)
  @haml.render(owner, locals, &block)
end