Class: Monotes::IO::FSDelegate
- Inherits:
-
Object
- Object
- Monotes::IO::FSDelegate
- Includes:
- AppDirectory
- Defined in:
- lib/monotes/IO/fs_delegate.rb
Instance Method Summary collapse
- #load(username, repository) ⇒ Object
-
#save(username, repository, issues) ⇒ Object
issues: Issues represented as Hash.
Methods included from AppDirectory
Instance Method Details
#load(username, repository) ⇒ Object
22 23 24 25 |
# File 'lib/monotes/IO/fs_delegate.rb', line 22 def load(username, repository) abs_path = File.join(app_path, username, "#{repository}.yaml") YAML.load_file(abs_path) end |
#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 |