Module: Cell::ViewModel::TemplateFor
- Included in:
- Cell::ViewModel
- Defined in:
- lib/cell/view_model.rb
Instance Method Summary collapse
Instance Method Details
#find_template(options) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/cell/view_model.rb', line 144 def find_template() = () # imported by Erb, Haml, etc. # required options: :template_class, :suffix. everything else is passed to the template implementation. view = [:view] prefixes = [:prefixes] suffix = .delete(:suffix) view = "#{view}.#{suffix}" template_for(prefixes, view, ) or raise TemplateMissingError.new(prefixes, view) end |
#template_for(prefixes, view, options) ⇒ Object
156 157 158 159 160 |
# File 'lib/cell/view_model.rb', line 156 def template_for(prefixes, view, ) # we could also pass _prefixes when creating class.templates, because prefixes are never gonna change per instance. not too sure if i'm just assuming this or if people need that. # Note: options here is the template-relevant options, only. self.class.templates[prefixes, view, ] end |