Closed mainrs closed 8 years ago
Is there a possibility to pass the style as a symbol? I wanted to write a generic method for coloring aka:
def colorize(string, foreground, style = :reset) Rainbow(string).fg(foreground).style(style) end
Is there something similar possible?
You can use Ruby's public_send like this: Rainbow(string).public_send(style).
public_send
Rainbow(string).public_send(style)
Is there a possibility to pass the style as a symbol? I wanted to write a generic method for coloring aka:
Is there something similar possible?