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

Instance Method Summary collapse

Instance Attribute Details

#file_pathObject

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

#contentObject



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

#ctimeObject



29
30
31
# File 'app/models/concerns/fluentd/setting_archive/archivable.rb', line 29

def ctime
  with_file { File.ctime(file_path) }
end

#file_idObject



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

#nameObject



21
22
23
# File 'app/models/concerns/fluentd/setting_archive/archivable.rb', line 21

def name
  @name ||= with_file { File.basename(file_path) }
end