Could https://github.com/Dynflow/dynflow/blob/master/lib/dynflow/serializable.rb#L39 help here?