C#とかにもあるけど、さすがに Ruby のは超カンタンね。
なお、こういうのもあるので、比較してみるのも面白いかも。
require 'pstore' class String def LoadObject r = nil db = PStore.new(self) db.transaction{|pstore| r = pstore["data"] } r end def SaveObject(obj) db = PStore.new(self) db.transaction{|pstore| pstore["data"] = obj.clone } end end
obj = 何かオブジェクト.new obj.なんたら = うんたら obj.ふが = ほげ : "setup.data".SaveObject(obj)
obj = "setup.data".LoadObject
うん。
細けえ事ぁいいんだよって、スパーンと保存できるから便利よ。やってみて。