Class: Astrails::Safe::Source
- Inherits:
-
Stream
- Object
- Stream
- Astrails::Safe::Source
show all
- Defined in:
- lib/astrails/safe/source.rb
Instance Attribute Summary collapse
Attributes inherited from Stream
#config
Instance Method Summary
collapse
Methods inherited from Stream
#expand
Constructor Details
#initialize(id, config) ⇒ Source
Returns a new instance of Source.
6
7
8
|
# File 'lib/astrails/safe/source.rb', line 6
def initialize(id, config)
@id, @config = id.to_s, config
end
|
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5
6
7
|
# File 'lib/astrails/safe/source.rb', line 5
def id
@id
end
|
Instance Method Details
#backup ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# 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
)
@backup.filename = filename
@backup
end
|
#filename ⇒ Object
18
19
20
|
# File 'lib/astrails/safe/source.rb', line 18
def filename
@filename ||= expand(":kind-:id.:timestamp")
end
|
#kind ⇒ Object
14
15
16
|
# File 'lib/astrails/safe/source.rb', line 14
def kind
self.class.human_name
end
|
#timestamp ⇒ Object
10
11
12
|
# File 'lib/astrails/safe/source.rb', line 10
def timestamp
Time.now.strftime("%y%m%d-%H%M")
end
|