Module: ExpressTemplates::Components::Capabilities::Templating::InstanceMethods
- Defined in:
- lib/express_templates/components/capabilities/templating.rb
Instance Method Summary collapse
-
#_compile_fragment(block, options = {}) ⇒ Object
Expands and compiles the supplied block representing a template fragment.
- #lookup(fragment_name, options = {}) ⇒ Object
Instance Method Details
#_compile_fragment(block, options = {}) ⇒ Object
Expands and compiles the supplied block representing a template fragment.
Any supplied options are passed as locals for use during expansion.
Returns a string containing ruby code which evaluates to markup.
186 187 188 189 |
# File 'lib/express_templates/components/capabilities/templating.rb', line 186 def _compile_fragment(block, = {}) (nil, self.class.special_handlers, ) (&block).map(&:compile).join("+").gsub('"+"', '') end |
#lookup(fragment_name, options = {}) ⇒ Object
171 172 173 174 175 176 177 178 |
# File 'lib/express_templates/components/capabilities/templating.rb', line 171 def lookup(fragment_name, ={}) fragment = self.class[fragment_name] if fragment.kind_of?(Proc) _compile_fragment(fragment, ) else fragment end end |