Class: BackupRestorer::FilePath

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ FilePath

Returns a new instance of FilePath.



59
60
61
62
# File 'lib/backup-restorer.rb', line 59

def initialize(filepath)
  @full_path = filepath
  @parent_path = get_parent_path
end

Instance Attribute Details

#existance_on_sourceObject

Returns the value of attribute existance_on_source.



58
59
60
# File 'lib/backup-restorer.rb', line 58

def existance_on_source
  @existance_on_source
end

#full_pathObject

Returns the value of attribute full_path.



58
59
60
# File 'lib/backup-restorer.rb', line 58

def full_path
  @full_path
end

#parent_pathObject

Returns the value of attribute parent_path.



58
59
60
# File 'lib/backup-restorer.rb', line 58

def parent_path
  @parent_path
end

Instance Method Details

#exists_on_destination?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/backup-restorer.rb', line 63

def exists_on_destination?
  File.exist?("#{CONF["paths"]["destination"]}/#{@full_path}")
end

#exists_on_source?(type) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
70
# File 'lib/backup-restorer.rb', line 67

def exists_on_source?(type)
  return @existance_on_source if type == "remote"
  File.exist?("#{CONF["paths"]["source"][@type]}/#{file_path.full_path}")
end