Class: Backup::Syncer::Cloud::LocalFile
- Inherits:
-
Object
- Object
- Backup::Syncer::Cloud::LocalFile
- Defined in:
- lib/backup/syncer/cloud.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#md5 ⇒ Object
readonly
Returns the value of attribute md5.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(directory, line) ⇒ LocalFile
constructor
Creates a new LocalFile object using the given directory and line from the md5 hash checkup.
-
#relative_path ⇒ Object
Returns the relative path to the file.
Constructor Details
#initialize(directory, line) ⇒ LocalFile
Creates a new LocalFile object using the given directory and line from the md5 hash checkup. This object figures out the path, relative_path and md5 hash for the file.
176 177 178 179 |
# File 'lib/backup/syncer/cloud.rb', line 176 def initialize(directory, line) @directory = directory @path, @md5 = *line.chomp.match(/^MD5\(([^\)]+)\)= (\w+)$/).captures end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
170 171 172 |
# File 'lib/backup/syncer/cloud.rb', line 170 def directory @directory end |
#md5 ⇒ Object (readonly)
Returns the value of attribute md5.
170 171 172 |
# File 'lib/backup/syncer/cloud.rb', line 170 def md5 @md5 end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
170 171 172 |
# File 'lib/backup/syncer/cloud.rb', line 170 def path @path end |
Instance Method Details
#relative_path ⇒ Object
Returns the relative path to the file.
183 184 185 186 |
# File 'lib/backup/syncer/cloud.rb', line 183 def relative_path @relative_path ||= path.gsub %r{^#{directory}}, directory.split('/').last end |