Class: Cloudpress::Dropbox::Cleaner
- Inherits:
-
Object
- Object
- Cloudpress::Dropbox::Cleaner
- Defined in:
- lib/cloudpress/dropbox/cleaner.rb
Instance Method Summary collapse
- #clean! ⇒ Object
-
#initialize(remote_paths, local_paths) ⇒ Cleaner
constructor
A new instance of Cleaner.
- #orphaned_paths ⇒ Object
Constructor Details
#initialize(remote_paths, local_paths) ⇒ Cleaner
Returns a new instance of Cleaner.
5 6 7 8 |
# File 'lib/cloudpress/dropbox/cleaner.rb', line 5 def initialize(remote_paths, local_paths) @local_paths = local_paths @remote_paths = remote_paths end |
Instance Method Details
#clean! ⇒ Object
14 15 16 |
# File 'lib/cloudpress/dropbox/cleaner.rb', line 14 def clean! Post.where(file_path: orphaned_paths).destroy_all if orphaned_paths.any? end |
#orphaned_paths ⇒ Object
10 11 12 |
# File 'lib/cloudpress/dropbox/cleaner.rb', line 10 def orphaned_paths @orphaned_paths ||= @local_paths - @remote_paths end |