Sha256: 3851f69432eadac83f48e587fe05c2524d6b0de67e082ab1baf693cf3da3847d
Contents?: true
Size: 1005 Bytes
Versions: 8
Compression:
Stored size: 1005 Bytes
Contents
module Astrails module Safe class Source < Stream attr_accessor :id def initialize(id, config) @id, @config = id.to_s, config end def timestamp Time.now.strftime("%y%m%d-%H%M") end def kind self.class.human_name end def filename @filename ||= expand(":kind-:id.:timestamp") end 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 protected def self.human_name name.split('::').last.downcase end end end end
Version data entries
8 entries across 8 versions & 4 rubygems