Ruby-haml: Difference between revisions
From Bashlinux
Jump to navigationJump to search
Content deleted Content added
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
<pre><nowiki> |
<pre><nowiki> |
||
gem install haml |
gem install haml |
||
</nowiki></pre> |
|||
== Arrays == |
|||
When print an array with the `collect` method, if is evaluating in the header where "-" can be matched or a property in the form "name:" the result will print a `0000` at the end, because obviously the string in question es evaluated and added to the end. In order to avoid this string, add the method `reject` to the end, so if it found one of the above matched characters/strings, it won't be displayed and then `0000` won't be displayed. |
|||
<pre><nowiki>#!wiki ruby |
|||
[email protected] do |prop| |
|||
%p #{prop} |
|||
</nowiki></pre> |
</nowiki></pre> |
||
Revision as of 09:20, 22 February 2010
Installation
Install as root the ruby gem
gem install haml
Arrays
When print an array with the `collect` method, if is evaluating in the header where "-" can be matched or a property in the form "name:" the result will print a `0000` at the end, because obviously the string in question es evaluated and added to the end. In order to avoid this string, add the method `reject` to the end, so if it found one of the above matched characters/strings, it won't be displayed and then `0000` won't be displayed.
#!wiki ruby [email protected] do |prop| %p #{prop}