Class: UndriveGoogle::Actions::Sweep
- Inherits:
-
Object
- Object
- UndriveGoogle::Actions::Sweep
- Defined in:
- lib/undrive_google/actions/sweep.rb
Overview
Empty the directory before putting liberated files into it?
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
Instance Method Summary collapse
-
#initialize ⇒ Sweep
constructor
A new instance of Sweep.
- #sweep! ⇒ Object
Constructor Details
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
7 8 9 |
# File 'lib/undrive_google/actions/sweep.rb', line 7 def dir @dir end |
Instance Method Details
#sweep! ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/undrive_google/actions/sweep.rb', line 13 def sweep! return if !dir || dir.length.zero? || dir == "/" return unless Dir.exist?(dir) return if Dir.empty?(dir) puts "Sweeping directory clean #{dir}" if Options.instance.verbose FileUtils.rm_rf Dir.glob("#{dir}/*") end |