Module: Persistable
- Included in:
- Application
- Defined in:
- lib/a-commons.rb
Instance Method Summary collapse
- #append_persistent_property(_persist_file, _persistent_key, _persistent_value) ⇒ Object
- #override_persistent(_persist_file, _persistent_hash) ⇒ Object
Instance Method Details
#append_persistent_property(_persist_file, _persistent_key, _persistent_value) ⇒ Object
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
# File 'lib/a-commons.rb', line 1011 def append_persistent_property(_persist_file, _persistent_key, _persistent_value) if FileTest::exist?(_persist_file) f = File.new(_persist_file, "w+") begin if f if _persistent_key f.syswrite(_persistent_key+'='+_persistent_value+"\n") end end ensure f.close unless f.nil? end end end |
#override_persistent(_persist_file, _persistent_hash) ⇒ Object
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 |
# File 'lib/a-commons.rb', line 994 def override_persistent(_persist_file, _persistent_hash) if FileTest::exist?(_persist_file) && File.stat(_persist_file).writable? f = File.new(_persist_file, "w") begin if f if _persistent_hash _persistent_hash.each{|key,value| f.syswrite(key+'='+value+"\n") } end end ensure f.close unless f.nil? end end end |