mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 02:46:11 +02:00
Fix to define file_path_of as class method.
This commit is contained in:
parent
a28b71084c
commit
5c3e8952bc
@ -1,8 +1,19 @@
|
||||
class Fluentd
|
||||
module SettingArchive
|
||||
module Archivable
|
||||
extend ActiveSupport::Concern
|
||||
attr_accessor :file_path
|
||||
|
||||
module ClassMethods
|
||||
private
|
||||
|
||||
def file_path_of(dir, id)
|
||||
file_path = Pathname.new(dir).join("#{id}#{self::FILE_EXTENSION}")
|
||||
raise "No such a file #{file_path}" unless File.exist?(file_path)
|
||||
file_path
|
||||
end
|
||||
end
|
||||
|
||||
def file_id
|
||||
@file_id ||= with_file { name.gsub(/#{self.class::FILE_EXTENSION}\Z/,'') }
|
||||
end
|
||||
@ -21,12 +32,6 @@ class Fluentd
|
||||
|
||||
private
|
||||
|
||||
def file_path_of(dir, id)
|
||||
file_path = Pathname.new(dir).join("#{id}#{self.class::FILE_EXTENSION}")
|
||||
raise "No such a file #{file_path}" unless File.exist?(file_path)
|
||||
file_path
|
||||
end
|
||||
|
||||
def with_file
|
||||
return nil unless file_path && File.exist?(file_path)
|
||||
yield
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user