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
158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/cell/view_model.rb', line 158 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
170 171 172 173 174 |
# File 'lib/cell/view_model.rb', line 170 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 |