Class: Cutaneous::CachingEngine

Inherits:
Engine
  • Object
show all
Defined in:
lib/cutaneous/engine.rb

Overview

A caching version of the default Engine implementation

Instance Attribute Summary collapse

Attributes inherited from Engine

#default_format, #loader_class, #roots

Instance Method Summary collapse

Methods inherited from Engine

#convert, #convert_string, #dynamic_template?, #file_loader, #proc_template, #render_file, #render_string, #template_exists?, #template_location

Constructor Details

#initialize(template_roots, syntax, default_format = "html") ⇒ CachingEngine



78
79
80
81
82
83
# File 'lib/cutaneous/engine.rb', line 78

def initialize(template_roots, syntax, default_format = "html")
  super
  @loader_class = CachedFileLoader
  @loaders      = {}
  @write_compiled_scripts = true
end

Instance Attribute Details

#write_compiled_scripts=(value) ⇒ Object (writeonly)

Sets the attribute write_compiled_scripts



76
77
78
# File 'lib/cutaneous/engine.rb', line 76

def write_compiled_scripts=(value)
  @write_compiled_scripts = value
end

Instance Method Details

#file_loader_instance(format) ⇒ Object



85
86
87
88
89
# File 'lib/cutaneous/engine.rb', line 85

def file_loader_instance(format)
  @loaders[format] ||= super.tap do |loader|
    loader.write_compiled_scripts = @write_compiled_scripts if loader.respond_to?(:write_compiled_scripts=)
  end
end