Class: Outback::TargetArchive

Inherits:
Archive show all
Defined in:
lib/outback/target_archive.rb

Constant Summary

Constants inherited from Archive

Archive::NAME_PATTERN

Instance Attribute Summary collapse

Attributes inherited from Archive

#backup_name, #filename, #size, #source_name, #timestamp

Instance Method Summary collapse

Constructor Details

#initialize(filename, size, target) ⇒ TargetArchive

Returns a new instance of TargetArchive.



5
6
7
8
9
# File 'lib/outback/target_archive.rb', line 5

def initialize(filename, size, target)
  super(filename)
  @size = size
  @target = target
end

Instance Attribute Details

#targetObject (readonly)

Returns the value of attribute target.



3
4
5
# File 'lib/outback/target_archive.rb', line 3

def target
  @target
end

Instance Method Details

#match?(name) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/outback/target_archive.rb', line 11

def match?(name)
  name == backup_name
end

#outdated?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
# File 'lib/outback/target_archive.rb', line 19

def outdated?
  if timestamp && ttl
    Time.now - Time.strptime(timestamp, Outback::TIME_FORMAT) > ttl
  end
end

#to_sObject



25
26
27
# File 'lib/outback/target_archive.rb', line 25

def to_s
  "#{target}: #{filename}"
end

#ttlObject



15
16
17
# File 'lib/outback/target_archive.rb', line 15

def ttl
  target && target.ttl
end