RuHL Reserved Words
RuHL has a set of reserved keywords for added functionality. The intent is to keep this list to a minimum, so it is preferred to make a keyword smarter than to add a new one.
Here is the current list:
_ render _ ( Examples)
This is used in your layout and lets rule know where to inject the rendered sub content. Similar to “= yield”.
_partial ( Examples)
- Path to a partial file. RuHL must be able to find/read this file.
_if ( Examples)
- If the method returns true, processing will continue.
- If the method returns a value other than true, the inner_html of the tag will be set to that value.
- If the method returns false or nil, processing will halt and the tag will not be included on output.
- If the method returns an object that is type Enumerable, responds to empty? and empty? returns true, processing will halt and the tag will not be included on output.
_unless ( Examples)
- If the method returns true, processing will halt and the tag will not included on output.
- If the method returns false, processing will continue.
_use ( Examples)
- The object returned is used within the scope of the tag.
- If the method returns an array of objects (checks for type of Enumerable), RuHL will iteratate over the collection and render the contents of the tag against the collection item.
_use_if
- Essentially combines the logic of _if and _use so you don’t have to type more.
_swap ( Examples)
- The tag is replaced with the value of the method.
