Class: Kinksync::Path2Sync
- Inherits:
-
Object
- Object
- Kinksync::Path2Sync
- Defined in:
- lib/kinksync/path_2_sync.rb
Overview
Class that represents an absolute local or remote path which contains file(s) and/or directories to sync
Instance Method Summary collapse
-
#initialize(path) ⇒ Path2Sync
constructor
Configures a Path2Sync class.
-
#sync ⇒ Object
Syncs all files in path and its subdirectories, ignores symlinks.
Constructor Details
#initialize(path) ⇒ Path2Sync
Configures a Path2Sync class
12 13 14 |
# File 'lib/kinksync/path_2_sync.rb', line 12 def initialize(path) @path = File.(path) end |
Instance Method Details
#sync ⇒ Object
Syncs all files in path and its subdirectories, ignores symlinks
21 22 23 24 25 26 27 28 |
# File 'lib/kinksync/path_2_sync.rb', line 21 def sync synced = [] files_to_sync = Find.find(@path).select do |f| File.file?(f) && !File.symlink?(f) end files_to_sync.each { |f| synced.push(f) if File2Sync.new(f).sync } synced end |