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
620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
# File 'lib/a-commons.rb', line 620 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
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 |
# File 'lib/a-commons.rb', line 603 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 |