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
695 696 697 698 699 700 701 702 703 704 705 706 707 708 |
# File 'lib/a-commons.rb', line 695 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
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
# File 'lib/a-commons.rb', line 678 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 |