lib/webtranslateit/safe/source.rb in webtranslateit-safe-0.4.3 vs lib/webtranslateit/safe/source.rb in webtranslateit-safe-0.4.4
- old
+ new
@@ -1,12 +1,16 @@
module WebTranslateIt
+
module Safe
+
class Source < Stream
attr_accessor :id
+
def initialize(id, config)
- @id, @config = id.to_s, config
+ @id = id.to_s
+ @config = config
end
def timestamp
Time.now.strftime('%y%m%d-%H%M')
end
@@ -19,29 +23,29 @@
@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
+ 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
+end