class Astrails::Safe::Source
Attributes
id[RW]
Public Class Methods
new(id, config)
click to toggle source
# File lib/astrails/safe/source.rb, line 6 def initialize(id, config) @id, @config = id.to_s, config end
Protected Class Methods
human_name()
click to toggle source
# File lib/astrails/safe/source.rb, line 40 def self.human_name name.split('::').last.downcase end
Public Instance Methods
backup()
click to toggle source
# File lib/astrails/safe/source.rb, line 22 def backup return @backup if @backup @backup = Backup.new( :id => @id, :kind => kind, :extension => extension, :command => command, :timestamp => timestamp ) # can't do this in the initializer hash above since # filename() calls expand() which requires @backup # FIXME: move expansion to the backup (last step in ctor) assign :tags here @backup.filename = filename @backup end
filename()
click to toggle source
# File lib/astrails/safe/source.rb, line 18 def filename @filename ||= expand(":kind-:id.:timestamp") end
kind()
click to toggle source
# File lib/astrails/safe/source.rb, line 14 def kind self.class.human_name end
timestamp()
click to toggle source
# File lib/astrails/safe/source.rb, line 10 def timestamp Time.now.strftime("%y%m%d-%H%M") end