Thank you for your fast reply. I do not get this to work. Should it
work?
I have haml (2.2.3) installed if that make any difference?


controller.rb:

def func(hash)
    hash.each_pair do |key, val|
        puts "#{key} ->#{val}"
    end
end

view.haml:

%p #{func({"animal" => true, "number" => 5})}


Returns:

number ->5 animal ->true
number5animaltrue



On Sep 28, 4:33 pm, Nathan Weizenbaum <[email protected]> wrote:
> I think the example you gave should work, but there are a few cases where
> the Haml parser will fail to parse Ruby interpolation. The following, for
> example:
>
>     foo #{"bar}"}
>
> This is because Haml doesn't do any parsing of the Ruby code except to try
> to make sure brackets are balanced, so brackets within Ruby strings will be
> counted as Haml brackets. At some point, Haml may try to do some basic Ruby
> lexing to fix this in more cases, but that's pretty difficult to get right.
>
>
>
> On Mon, Sep 28, 2009 at 12:56 AM, harald <[email protected]> wrote:
>
> > I have just start using haml but have some problems to understand how
> > to escape a ruby hash.
>
> >  like this one for example:
>
> > #{func({"animal" => true, "nummber" => 5})}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to