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