class Autosftp::FileAccess

Constants

INIT_FILE

Public Class Methods

create() click to toggle source
# File lib/autosftp/file_access.rb, line 8
def create
  File.open(path, "w").close()
end
delete(word) click to toggle source
# File lib/autosftp/file_access.rb, line 36
def delete word
  read_file = YAML.load_file path
  read_file.delete(word)

  f = open(path, "w")
  f.write(YAML.dump(read_file))
  f.close
end
exist?() click to toggle source
# File lib/autosftp/file_access.rb, line 16
def exist?
  File.exist? path
end
path() click to toggle source
# File lib/autosftp/file_access.rb, line 12
def path
  File.join(Dir.pwd, INIT_FILE)
end
read() click to toggle source
# File lib/autosftp/file_access.rb, line 32
def read
  YAML.load_file path
end
save(word, hash) click to toggle source
# File lib/autosftp/file_access.rb, line 20
def save word, hash
  save_file = YAML.load_file path
  if false == save_file
    save_file = {}
  end
  save_file[word] = hash

  f = open(path, "w")
  f.write(YAML.dump(save_file))
  f.close
end