Class: Macros4Cuke::Templating::Placeholder
- Inherits:
-
UnaryElement
- Object
- UnaryElement
- Macros4Cuke::Templating::Placeholder
- Defined in:
- lib/macros4cuke/templating/placeholder.rb
Overview
Class used internally by the template engine. Represents a named placeholder in a template, that is, a name placed between <..> in the template. At rendition, a placeholder is replaced by the text value that is associated with it.
Instance Attribute Summary
Attributes inherited from UnaryElement
Instance Method Summary collapse
-
#render(aContextObject, theLocals) ⇒ String
Render the placeholder given the passed arguments.
Methods inherited from UnaryElement
Constructor Details
This class inherits a constructor from Macros4Cuke::UnaryElement
Instance Method Details
#render(aContextObject, theLocals) ⇒ String
Render the placeholder given the passed arguments. This method has the same signature as the Engine#render method.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/macros4cuke/templating/placeholder.rb', line 23 def render(aContextObject, theLocals) actual_value = retrieve_value_from(aContextObject, theLocals) result = case actual_value when NilClass '' when Array # TODO: Move away from hard-coded separator. actual_value.join('<br/>') when String actual_value else actual_value.to_s end return result end |