Difference between revisions of "Ruby-haml"

From Bashlinux
Jump to: navigation, search
(talk)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
= Ruby: HAML =
 
= Ruby: HAML =
  +
== How to install Ruby Gem HAML ==
== Installation ==
 
 
Install as root the ruby gem
 
Install as root the ruby gem
 
 
Line 9: Line 9:
   
   
  +
== How to handle arrays on 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.
+
When printing 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>
 
<pre><nowiki>

Revision as of 15:21, 4 June 2012

Ruby: HAML

How to install Ruby Gem HAML

Install as root the ruby gem

 gem install haml
 


How to handle arrays on HAML

When printing 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.

 [email protected] do |prop|
   %p #{prop}
 


Links