So I'm aware that you can do html_attributes("data-value": nil) if condition? to return "data-value" if the condition is truthy.
Is that the cleanest / only format? On reading the code, I briefly thought html_attributes("data-value") if condition? might work, but I overlooked the stringify_keys statement that means it needs to be a hash.
Would a PR to support strings, or arrays of strings, in the method be considered?
Or is this more a case of we've provided a basic clean interface to prevent too much magic producing bad HTML, so the preference is not sprinkle too much interface overloading magic in?!
So I'm aware that you can do
html_attributes("data-value": nil) if condition?to return"data-value"if the condition is truthy.Is that the cleanest / only format? On reading the code, I briefly thought
html_attributes("data-value") if condition?might work, but I overlooked thestringify_keysstatement that means it needs to be a hash.Would a PR to support strings, or arrays of strings, in the method be considered?
Or is this more a case of we've provided a basic clean interface to prevent too much magic producing bad HTML, so the preference is not sprinkle too much interface overloading magic in?!