Class: TemplateLoader
- Inherits:
-
Loader
- Object
- Loader
- TemplateLoader
- Defined in:
- lib/shot_mvc/template_loader.rb
Instance Method Summary collapse
- #get(name) ⇒ Object
-
#initialize(client) ⇒ TemplateLoader
constructor
A new instance of TemplateLoader.
Constructor Details
#initialize(client) ⇒ TemplateLoader
Returns a new instance of TemplateLoader.
18 19 20 21 |
# File 'lib/shot_mvc/template_loader.rb', line 18 def initialize(client) super(client) @type = 'template' end |
Instance Method Details
#get(name) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/shot_mvc/template_loader.rb', line 23 def get(name) if template_exists? name if full_path? name Template.new name else Template.new "./app/views/#{name}.erb" end else if @client.config['server']['Security']['VisualErrors'] then begin raise TemplateLoadException.new "Could not load #{name}. Verify it exists at app/views/#{name}.erb" rescue Exception => ex template = Template.new "#{gem_root}/app/views/view_not_found.erb" template.data = { :requested_view => name, :exception => ex } return template end else raise TemplateLoadException.new "Could not load #{name}. Verify it exists at app/views/#{name}.erb" end end end |