Class: Flexdot::Backup
- Inherits:
-
Object
- Object
- Flexdot::Backup
- Defined in:
- lib/flexdot/backup.rb
Constant Summary collapse
- BASE_DIR =
'backup'
Class Method Summary collapse
Instance Method Summary collapse
- #call(file) ⇒ Object
-
#initialize ⇒ Backup
constructor
A new instance of Backup.
Constructor Details
#initialize ⇒ Backup
Returns a new instance of Backup.
20 21 22 |
# File 'lib/flexdot/backup.rb', line 20 def initialize backup_dir.mkpath unless backup_dir.exist? end |
Class Method Details
.base_dir ⇒ Object
15 16 17 |
# File 'lib/flexdot/backup.rb', line 15 def base_dir Pathname.pwd.join(BASE_DIR) end |
.clear_all ⇒ Object
11 12 13 |
# File 'lib/flexdot/backup.rb', line 11 def clear_all base_dir.glob('*').each(&:rmtree) end |
Instance Method Details
#call(file) ⇒ Object
24 25 26 |
# File 'lib/flexdot/backup.rb', line 24 def call(file) FileUtils.mv(file, backup_dir) end |