module Persistable

Public Instance Methods

append_persistent_property(_persist_file, _persistent_key, _persistent_value) click to toggle source
# File lib/a-commons.rb, line 1112
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) click to toggle source
# File lib/a-commons.rb, line 1095
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") if key && value
          }
        end
      end
    ensure
      f.close unless f.nil?
    end
  end
end