Josef Reidinger write: <snip> > you don't provide to_json method which could be problem if we switch frontend > to json. > There you can benefit from serialization module which I write for BaseModel. > So instead of whole to_xml method you can get same result (and as bonus also > to_json and from_xml and from_json method) if you use this code: > (attr_serialized is needed to avoid callback instance serialization) > > include BaseModel::Serialization > attr_serialized :status, :progress, :subprogress >
There also problematic value. You as default use subprogress = nil (in constructor) ...but when you serialize, you use subprogress.to_i, which is for default value 0. So you cannot after deserialization recognize if subprogress is nil or 0. > > Note - all code is code from head, so no guaranty that it works out of box, > but it should work with little fixes. > > Josef > > -- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast (language,time,basesystem,ntp) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
