class RBarman::Backups

An array of {Backup}

Public Class Methods

all(server, opts={}) click to toggle source

Instructs the underlying (barman) command to get all backups for a specific server @param [String] server server name @param [Hash] opts options for creating {Backups} @option opts [Boolean] :with_wal_files whether to include {WalFiles} @return [Backups] an array of {Backup}

# File lib/rbarman/backups.rb, line 18
def self.all(server, opts={})
  cmd = CliCommand.new
  return Backups.new(cmd.backups(server, opts))
end
new(other=nil) click to toggle source

Initializes a new Array of {Backup} @param [Array,Backups] other appends all backups from another array

# File lib/rbarman/backups.rb, line 9
def initialize(other=nil)
  self.concat(other) if !other.nil? and other.is_a? Array
end

Public Instance Methods

latest() click to toggle source

Get the latest (newest) backup of all backups in the array @return [Backup] the latest {Backup}

# File lib/rbarman/backups.rb, line 25
def latest
  self.sort_by { |d| Time.parse(d.id) }.reverse.first
end
oldest() click to toggle source

Get the oldest backup of all backups in the array @return [Backup] the oldest {Backup}

# File lib/rbarman/backups.rb, line 31
def oldest
  self.sort_by { |d| Time.parse(d.id) }.first
end