My current usage is, need passing an object from UNIXServer to UnixSocket, i define a struct for serialize/deserialize from the JSON. string.
struct ProcessStatus
include JSON::Serializable
getter name, log_color # ...
def initialize(
@name : String,
@log_color : Symbol,
# ...
)
end
end
But, JSON not support symbol, i get some things error message like:
> 128 | begin
> 129 |
> 130 | ::Union(Symbol).new(pull)
^--
Error: undefined method 'new' for Symbol.class
And, Colorize not support string as argument
3 | puts "hello".colorize("blue")
^
Error: expected argument #1 to 'String#colorize' to be (Colorize::Color256 | Colorize::ColorANSI | Colorize::ColorRGB), Symbol or UInt8, not String
How to workaround on this?
Thanks.