I'm trying this (haml 6.3.0):
def my_helper
Haml::Helpers.html_concat('Hello, world!')
end
Then, in my.haml
I do this:
- my_helper
However, I'm getting:
NoMethodError: undefined method `html_concat' for Haml::Helpers:Module
What is the right method? Please, don't suggest to use = my_helper
. My real case is much more complicated and I do need to print to the buffer directly instead of returning a string.
The function haml_concat
was removed in 6.0.0 according to the changelog. The function used to use methods that modified the internal buffer and the changelog says this part of the API has been removed after 6.0.0 and there is no alternative:
Ones that rely on
Haml::Buffer
have no direct alternative by design. They existed at the cost of performance. You need to define a helper, instantiate a String buffer in it, append stuff to it, and call it inside=
.
So it looks like there is no way to write to the Haml buffer without =
anymore.