Module: Fluentd::SettingArchive::Archivable
- Extended by:
- ActiveSupport::Concern
- Included in:
- BackupFile, Note
- Defined in:
- app/models/concerns/fluentd/setting_archive/archivable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#file_path ⇒ Object
Returns the value of attribute file_path.
Instance Method Summary collapse
Instance Attribute Details
#file_path ⇒ Object
Returns the value of attribute file_path.
5 6 7 |
# File 'app/models/concerns/fluentd/setting_archive/archivable.rb', line 5 def file_path @file_path end |
Instance Method Details
#content ⇒ Object
25 26 27 |
# File 'app/models/concerns/fluentd/setting_archive/archivable.rb', line 25 def content @content ||= with_file { File.open(file_path, "r") { |f| f.read } } end |
#ctime ⇒ Object
29 30 31 |
# File 'app/models/concerns/fluentd/setting_archive/archivable.rb', line 29 def ctime with_file { File.ctime(file_path) } end |
#file_id ⇒ Object
17 18 19 |
# File 'app/models/concerns/fluentd/setting_archive/archivable.rb', line 17 def file_id @file_id ||= with_file { name.gsub(/#{Regexp.escape(self.class::FILE_EXTENSION)}\Z/,'') } end |
#name ⇒ Object
21 22 23 |
# File 'app/models/concerns/fluentd/setting_archive/archivable.rb', line 21 def name @name ||= with_file { File.basename(file_path) } end |