Class: Styoe::DotFileManager
- Inherits:
-
Object
- Object
- Styoe::DotFileManager
- Defined in:
- lib/styoe/dot_file_manager.rb
Instance Method Summary collapse
Instance Method Details
#find_recursively(path) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/styoe/dot_file_manager.rb', line 12 def find_recursively(path) return DotFile.read_from_path(path) if File.exist?(path) raise ConfigurationNotFound if reached_root?(path) find_recursively("../#{path}") end |
#save_near(filename, new_name: "", contents: "") ⇒ Object
19 20 21 22 23 |
# File 'lib/styoe/dot_file_manager.rb', line 19 def save_near(filename, new_name: "", contents: "") near_file = find_recursively(filename) path_to_save = filename_near(near_file.path, new_name) write_file(path_to_save, contents) end |