mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 10:56:11 +02:00
Remove keyword argument from methods
for Ruby 1.9
This commit is contained in:
parent
7c797d42b0
commit
0786fafb9b
@ -5,7 +5,7 @@ class Fluentd::Settings::HistoriesController < ApplicationController
|
||||
|
||||
def index
|
||||
@backup_files = @fluentd.agent.backup_files_in_new_order.map do |file_path|
|
||||
Fluentd::Setting::BackupFile.new(file_path: file_path)
|
||||
Fluentd::Setting::BackupFile.new(file_path)
|
||||
end
|
||||
end
|
||||
|
||||
@ -21,11 +21,6 @@ class Fluentd::Settings::HistoriesController < ApplicationController
|
||||
|
||||
def find_backup_file
|
||||
#Do not use BackupFile.new(params[:id]) because params[:id] can be any path.
|
||||
@backup_file = Fluentd::Setting::BackupFile.find_by_file_id(
|
||||
{
|
||||
backup_dir: @fluentd.agent.config_backup_dir,
|
||||
file_id: params[:id]
|
||||
}
|
||||
)
|
||||
@backup_file = Fluentd::Setting::BackupFile.find_by_file_id(@fluentd.agent.config_backup_dir, params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,7 +7,7 @@ class Fluentd::SettingsController < ApplicationController
|
||||
|
||||
def show
|
||||
@backup_files = @fluentd.agent.backup_files_in_new_order[0..4].map do |file_path|
|
||||
Fluentd::Setting::BackupFile.new(file_path: file_path)
|
||||
Fluentd::Setting::BackupFile.new(file_path)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -3,14 +3,14 @@ class Fluentd
|
||||
class BackupFile
|
||||
attr_accessor :file_path
|
||||
|
||||
def self.find_by_file_id(backup_dir: , file_id: )
|
||||
def self.find_by_file_id(backup_dir, file_id)
|
||||
file_path = Pathname.new(backup_dir).join("#{file_id}.conf")
|
||||
raise "No suce file #{file_path}" unless File.exist?(file_path)
|
||||
|
||||
new(file_path: file_path)
|
||||
new(file_path)
|
||||
end
|
||||
|
||||
def initialize(file_path: nil)
|
||||
def initialize(file_path)
|
||||
@file_path = file_path
|
||||
end
|
||||
|
||||
@ -31,6 +31,7 @@ class Fluentd
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def with_file
|
||||
return nil unless file_path && File.exist?(file_path)
|
||||
yield
|
||||
|
||||
@ -26,7 +26,8 @@ describe "histories", stub: :daemon do
|
||||
end
|
||||
|
||||
describe 'show' do
|
||||
let(:last_backup_file) { Fluentd::Setting::BackupFile.new(file_path: daemon.agent.backup_files_in_new_order.first) }
|
||||
let(:last_backup_file) { Fluentd::Setting::BackupFile.new(daemon.agent.backup_files_in_new_order.first) }
|
||||
|
||||
before do
|
||||
visit "/daemon/setting/histories/#{last_backup_file.file_id}"
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user