Class: Malt::Engines::Abstract
- Inherits:
-
Object
- Object
- Malt::Engines::Abstract
- Includes:
- Kernel
- Defined in:
- lib/malt/engines/abstract.rb
Overview
Abstract Template class serves as the base class for all other Template classes.
Direct Known Subclasses
BlueCloth, Erb, Erubis, Haml, Kramdown, Less, Liquid, RDiscount, RDoc, RTALS, Radius, RedCloth, Ruby, Sass, Tenjin
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Access to the options given to the initializer.
Class Method Summary collapse
-
.default(*exts) ⇒ Object
Register and set as the default for given extensions.
-
.register(*exts) ⇒ Object
Register the class to an extension type.
Instance Method Summary collapse
- #cache? ⇒ Boolean
- #compile(db, &yld) ⇒ Object
-
#initialize(settings = {}) ⇒ Abstract
constructor
Override this method to load rendering engine library.
-
#render(text, options = {}) ⇒ Object
format, text, file, db, &yld).
Constructor Details
#initialize(settings = {}) ⇒ Abstract
Override this method to load rendering engine library.
46 47 48 49 50 51 52 53 |
# File 'lib/malt/engines/abstract.rb', line 46 def initialize(settings={}) @settings = settings.rekey @cache = {} @source = {} initialize_engine end |
Instance Attribute Details
#settings ⇒ Object (readonly)
Access to the options given to the initializer. Returns an OpenStruct object.
57 58 59 |
# File 'lib/malt/engines/abstract.rb', line 57 def settings @settings end |
Class Method Details
.default(*exts) ⇒ Object
Register and set as the default for given extensions.
38 39 40 41 42 43 |
# File 'lib/malt/engines/abstract.rb', line 38 def self.default(*exts) register(*exts) exts.each do |ext| Malt.config.engine[ext.to_sym] = self end end |
Instance Method Details
#cache? ⇒ Boolean
74 75 76 |
# File 'lib/malt/engines/abstract.rb', line 74 def cache? !settings[:nocache] end |
#compile(db, &yld) ⇒ Object
69 70 71 |
# File 'lib/malt/engines/abstract.rb', line 69 def compile(db, &yld) raise "not implemented" end |
#render(text, options = {}) ⇒ Object
format, text, file, db, &yld)
60 61 62 63 64 65 66 |
# File 'lib/malt/engines/abstract.rb', line 60 def render(text, ={}) #format, text, file, db, &yld) if format = [:format] raise "unsupported rendering -- #{format}" else raise "unsupported rendering" end end |