Method: Monotes::IO::FSDelegate#save

Defined in:
lib/monotes/IO/fs_delegate.rb

#save(username, repository, issues) ⇒ Object

issues: Issues represented as Hash



11
12
13
14
15
16
17
18
19
20
# File 'lib/monotes/IO/fs_delegate.rb', line 11

def save(username, repository, issues)
  if !File.directory?(app_path)
    Dir.mkdir(app_path)
  end
  user_folder = File.join(app_path, username)
  Dir.mkdir(user_folder) if !File.directory?(user_folder)
  File.open(File.join(user_folder, "#{repository}.yaml"), "w") do |handle|
    handle.write(issues.to_yaml)
  end
end