Displaying 1 result from an estimated 1 matches for "otherfuncthatreturnsstr".
2010 Dec 21
5
Rails, Ruby, haml, metaprogramming problem
...have hundreds of lines like the following:
- xyz = someFuncThatReturnsString(''xyz'')
and elsewhere
%div{''id'' => xyz}
The above lines work fine.
- - -
Attempting to keep things DRY (Don''t repeat yourself) I want to do
something like
- eval(otherFuncThatReturnsString(''xyz''))
where
otherFuncThatReturnsString(''xyz'')
returns
"xyz = someFuncThatReturnsString(''xyz'')"
When I do this, HAML no longer sees xyz as being defined when it
attempts to interpret
%div{''id'' => xy...