Module: Tadpole

Defined in:
lib/tadpole.rb,
lib/tadpole/main.rb,
lib/tadpole/filters.rb,
lib/tadpole/template.rb,
lib/tadpole/providers/erb.rb,
lib/tadpole/local_template.rb,
lib/tadpole/providers/file.rb,
lib/tadpole/providers/haml.rb,
lib/tadpole/providers/markaby.rb,
lib/tadpole/providers/template.rb,
lib/tadpole/providers/section_provider.rb

Defined Under Namespace

Modules: Filters, LocalTemplate, SectionProviders, Template Classes: MissingTemplateError

Constant Summary collapse

Version =
'0.1.7'
Root =
File.dirname(__FILE__)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cachingObject

Returns the value of attribute caching.



25
26
27
# File 'lib/tadpole/main.rb', line 25

def caching
  @caching
end

Class Method Details

.create_template(*path) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/tadpole/main.rb', line 45

def create_template(*path)
  path = absolutize_path(*path)
  name = template_mod_name(path)

  remove_const(name) unless caching rescue NameError
  return const_get(name) rescue NameError

  mod = create_template_mod(path)
  const_set(name, mod) 
end

.register_template_path(path) ⇒ Object



33
34
35
# File 'lib/tadpole/main.rb', line 33

def register_template_path(path)
  template_paths.push(path)
end

.template(*path) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/tadpole/main.rb', line 37

def template(*path)
  path = absolutize_path(*path)
  exists = find_matching_template_paths(path)
  raise MissingTemplateError, "no such template `#{path}'" if exists.empty?

  create_template(*path)
end

.template_pathsObject



29
30
31
# File 'lib/tadpole/main.rb', line 29

def template_paths
  @@template_paths ||= []
end