Class: Fluentd::SettingArchive::BackupFile
- Inherits:
-
Object
- Object
- Fluentd::SettingArchive::BackupFile
- Includes:
- Archivable
- Defined in:
- app/models/fluentd/setting_archive/backup_file.rb
Constant Summary collapse
- FILE_EXTENSION =
".conf".freeze
Instance Attribute Summary collapse
-
#note ⇒ Object
readonly
Returns the value of attribute note.
Attributes included from Archivable
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file_path, note = nil) ⇒ BackupFile
constructor
A new instance of BackupFile.
Methods included from Archivable
#content, #ctime, #file_id, #name
Constructor Details
#initialize(file_path, note = nil) ⇒ BackupFile
Returns a new instance of BackupFile.
14 15 16 17 |
# File 'app/models/fluentd/setting_archive/backup_file.rb', line 14 def initialize(file_path, note = nil) @file_path = file_path @note = note || Note.create(file_path.sub(/#{Regexp.escape(FILE_EXTENSION)}\z/, Note::FILE_EXTENSION)) end |
Instance Attribute Details
#note ⇒ Object (readonly)
Returns the value of attribute note.
5 6 7 |
# File 'app/models/fluentd/setting_archive/backup_file.rb', line 5 def note @note end |
Class Method Details
.find_by_file_id(backup_dir, file_id) ⇒ Object
9 10 11 12 |
# File 'app/models/fluentd/setting_archive/backup_file.rb', line 9 def self.find_by_file_id(backup_dir, file_id) note = Note.find_by_file_id(backup_dir, file_id) rescue nil new(file_path_of(backup_dir, file_id), note) end |