I have a class, JsonConnection
. I serialize an instance of that class, connection
, to YAML, and store it:
connection = JsonConnection.new
session[:con] = connection.to_yaml
Later, I use the JsonConnection
deserialized from the storage throughout my code:
def con
if session[:con]
YAML.load(session[:con])
end
end
Unfortunately, doing things this way means that RubyMine can't seem to tell what class of object con
is, and so my code is littered with inspection problems:
Is there a way I can explictly declare that my YAML.load()
returns a JsonConnection
so that my IDE will be able to identify it properly?