Module: Pancake::Mixins::Render::ClassMethods
- Defined in:
- lib/pancake/mixins/render.rb
Instance Method Summary collapse
- #_find_template(name) ⇒ Object
- #_find_view_context_class_for(template) ⇒ Object
- #_renderer_and_view_context_class_for(template) ⇒ Object
- #_template_cache ⇒ Object
- #_view_context_cache ⇒ Object
Instance Method Details
#_find_template(name) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/pancake/mixins/render.rb', line 36 def _find_template(name) renderer = _template_cache[name] return renderer if renderer renderer_path = unique_paths_for(:views, :invert => true).detect do |path| path.last =~ %r[^\/?(#{name})\.\w+$] end raise TemplateNotFound unless renderer_path _template_cache[name] = Template.new(name, renderer_path.join) end |
#_find_view_context_class_for(template) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/pancake/mixins/render.rb', line 53 def _find_view_context_class_for(template) _view_context_cache[template] ||= begin Class.new(self::ViewContext) end _view_context_cache[template] end |
#_renderer_and_view_context_class_for(template) ⇒ Object
60 61 62 |
# File 'lib/pancake/mixins/render.rb', line 60 def _renderer_and_view_context_class_for(template) [_find_template(template), _find_view_context_class_for(template)] end |
#_template_cache ⇒ Object
32 33 34 |
# File 'lib/pancake/mixins/render.rb', line 32 def _template_cache @_template_cache ||= {} end |
#_view_context_cache ⇒ Object
48 49 50 51 |
# File 'lib/pancake/mixins/render.rb', line 48 def _view_context_cache @_view_context_cache ||= {} @_view_context_cache end |