Class: Fluentd::SettingArchive::Note
- Inherits:
-
Object
- Object
- Fluentd::SettingArchive::Note
show all
- Includes:
- Archivable
- Defined in:
- app/models/fluentd/setting_archive/note.rb
Constant Summary
collapse
- FILE_EXTENSION =
".note".freeze
Instance Attribute Summary
Attributes included from Archivable
#file_path
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Archivable
#content, #ctime, #file_id, #name
Constructor Details
#initialize(file_path) ⇒ Note
Returns a new instance of Note.
17
18
19
|
# File 'app/models/fluentd/setting_archive/note.rb', line 17
def initialize(file_path)
@file_path = file_path
end
|
Class Method Details
.create(file_path) ⇒ Object
12
13
14
15
|
# File 'app/models/fluentd/setting_archive/note.rb', line 12
def self.create(file_path)
FileUtils.touch(file_path)
new(file_path)
end
|
.find_by_file_id(backup_dir, file_id) ⇒ Object
8
9
10
|
# File 'app/models/fluentd/setting_archive/note.rb', line 8
def self.find_by_file_id(backup_dir, file_id)
new(file_path_of(backup_dir, file_id))
end
|
Instance Method Details
#update!(content) ⇒ Object
21
22
23
24
25
|
# File 'app/models/fluentd/setting_archive/note.rb', line 21
def update!(content)
File.open(@file_path, "w") do |f|
f.write content
end
end
|