Class: Flexdot::Backup

Inherits:
Object
  • Object
show all
Defined in:
lib/flexdot/backup.rb

Constant Summary collapse

BASE_DIR =
'backup'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBackup

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_dirObject



15
16
17
# File 'lib/flexdot/backup.rb', line 15

def base_dir
  Pathname.pwd.join(BASE_DIR)
end

.clear_allObject



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