Ruby PStore 对象持久化技术

fayake · October 23, 2014 · Last by fayake replied at October 28, 2014 · 2689 hits

把标准数据结构转换成扁平数据形式,可被保存到磁盘或通过网络传输,供以后重新构造数据结构

class Person
attr_accessor :name
end
fred = Person.new
fred.name = 'Fred Bloggs'
laura = Person.new
laura.name = 'Laura Smith'

require 'pstore'
store = PStore.new('storagefile')
store.transaction do
store[:people] ||= Array.new
store[:people] << fred
store[:people]<<laura
end

#以后就可以从PStore数据库中检索数据

require 'pstore'
store = PStore.new('storagefile')
people = []
store.transaction do 
people = store[:people]
end

people.each do |p|
puts p.name
end

北京 推酷 http://www.tuicool.com/ 初创 在寻 ruby 队友

hi, 我是深圳 Ruby 圈子的组织者,有很多深圳的公司在招靠谱的 Ruby 工程师,可以先加入深圳 Ruby 的微信群,内部了解。请在 http://yafeilee.me/about 找到我的联系方式。

深圳有很多公司在招人,不过年后情况不知道

我们缺人哪,有兴趣可以过来看看。 https://ruby-china.org/topics/21680

亲,我对你第二个公司感兴趣,上线没?给个网址?难道是团 800 下面的惠 800?

6 Floor has deleted

#4 楼 @lewis 我看也很符合,不过我要年后才能去,请问到时贵公司还招人吗?

#1 楼 @kafka0102 Google 文章时,结果里经常有推酷链接,它只是原文的一份 copy. 这让人感到不适。可以把它从结果里去掉么?

#6 楼 @fayake 哦,这样。我之前只听过惠 800,见识少了……

加下我 QQ

有的啊,请看这个https://ruby-china.org/topics/[email protected],简历请发到:

#11 楼 @everants 发了,您 看合适吗

You need to Sign in before reply, if you don't have an account, please Sign up first.