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
567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
# File 'lib/a-commons.rb', line 567 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
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
# File 'lib/a-commons.rb', line 550 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 |