Class: Malt::Malted
Overview
Base class for the Tilt-like template classes.
Direct Known Subclasses
Tilted::Tilt::BlueClothTemplate, Tilted::Tilt::BuilderTemplate, Tilted::Tilt::CoffeeScriptTemplate, Tilted::Tilt::CreoleTemplate, Tilted::Tilt::ERBTemplate, Tilted::Tilt::ErectorTemplate, Tilted::Tilt::ErubisTemplate, Tilted::Tilt::HAMLTemplate, Tilted::Tilt::KramdownTemplate, Tilted::Tilt::LessTemplate, Tilted::Tilt::LiquidTemplate, Tilted::Tilt::MarkabyTemplate, Tilted::Tilt::MarukuTemplate, Tilted::Tilt::NokogiriTemplate, Tilted::Tilt::RDiscountTemplate, Tilted::Tilt::RDocTemplate, Tilted::Tilt::RadiusTemplate, Tilted::Tilt::RedClothTemplate, Tilted::Tilt::RedcarpetTemplate, Tilted::Tilt::SassTemplate, Tilted::Tilt::ScssTemplate, Tilted::Tilt::StringTemplate, Tilted::Tilt::WikiClothTemplate
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(file, options = {}) ⇒ Malted
Returns a new instance of Malted.
27
28
29
30
|
# File 'lib/malt/tilted.rb', line 27
def initialize(file, options={})
@file = file
@options = options || {}
end
|
Class Method Details
.engine_index ⇒ Object
8
9
10
|
# File 'lib/malt/tilted.rb', line 8
def self.engine_index
@@engine_index ||= {}
end
|
.malt_engine(engine_class = nil) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/malt/tilted.rb', line 13
def self.malt_engine(engine_class=nil)
if engine_class
@malt_engine = engine_class
engine_index[@malt_engine] = self
end
@malt_engine
end
|
Instance Method Details
#malt_engine ⇒ Object
22
23
24
|
# File 'lib/malt/tilted.rb', line 22
def malt_engine
self.class.malt_engine.new(@options)
end
|
#render(*data, &yields) ⇒ Object
33
34
35
36
|
# File 'lib/malt/tilted.rb', line 33
def render(*data, &yields)
text = File.read(@file)
malt_engine.render(:text=>text, :file=>@file, :data=>data, &yields)
end
|