Class: Ruty::Loader
- Inherits:
-
Object
- Object
- Ruty::Loader
- Defined in:
- lib/ruty/loaders.rb
Overview
base class for all loaders
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#get_template(name) ⇒ Object
method for loading templates in an application.
-
#initialize(options = nil) ⇒ Loader
constructor
A new instance of Loader.
-
#load_cached(name, parent = nil) ⇒ Object
load a template, probably from cache Per default this calls the load_local method with the same paramters.
-
#load_local(name, parent = nil) ⇒ Object
load a template by always reparsing it.
Constructor Details
#initialize(options = nil) ⇒ Loader
Returns a new instance of Loader.
15 16 17 18 19 20 |
# File 'lib/ruty/loaders.rb', line 15 def initialize =nil if not .nil? and not .is_a?(Hash) raise ArgumentError, 'loader options must be a hash or omitted' end @options = or {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/ruty/loaders.rb', line 13 def @options end |
Instance Method Details
#get_template(name) ⇒ Object
method for loading templates in an application. Returns a template instance with the loaded name.
40 41 42 |
# File 'lib/ruty/loaders.rb', line 40 def get_template name Template.new(load_cached(name)) end |
#load_cached(name, parent = nil) ⇒ Object
load a template, probably from cache Per default this calls the load_local method with the same paramters
25 26 27 |
# File 'lib/ruty/loaders.rb', line 25 def load_cached name, parent=nil load_local(name, parent) end |
#load_local(name, parent = nil) ⇒ Object
load a template by always reparsing it. That for example is used by the inheritance and inclusion system because the tags modify the nodelist returned by a loader. If parent is given it must be used to resolve relative paths
34 35 36 |
# File 'lib/ruty/loaders.rb', line 34 def load_local name, parent=nil raise NotImplementedError end |