Inversion::Template::
DefaultTag class
Superclass | Inversion::Template::CodeTag |
Inversion
‘default’ tag.
The default tag sets the default value of an attribute to a constant, the value of another attribute, or the results of evaluating a methodchain on an attribute.
Syntax
<!-- Set a default width that can be overridden by the controller --> <?default width to 120 ?> <?default employees to [] ?> <!-- Default an attribute to the value of a second attribute --> <?default content to body ?> <!-- Set the title to the employee's name if it hasn't been set explicitly --> <?default title to "%s, %s" % [ employee.lastname, employee.firstname ] ?>
Attributes
- format RW
the format string used to format the attribute in the template (if one was declared)
- literal RW
The literal, if the tag had one (as opposed to an attribute or methodchain)
- methodchain RW
the chain of methods that should be called (if any).
- name RW
the name of the attribute
Public Class Methods
Create a new DefaultTag
with the given ‘name`, which should be a valid Ruby identifier.
Public Instance Methods
Render the tag as the body of a comment, suitable for template debugging.
Set the specified value (if it’s nil) before rendering.
Render as the empty string.