Skip to content

Commit 937cc64

Browse files
author
travis
committed
Corrections after code review with rubocop.
Corrected redundant variable names. Removed useless variable assignment.
1 parent c3411a5 commit 937cc64

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/setup_issue_show.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22
require 'fileutils'
33
require 'pathname_redmine_version'
44

5+
# Identifies correct version of issues/VERSION.show.html.erb and
6+
# copies it to issues/show.html.erb
57
class SetupIssueShow
68
attr_accessor :issues_directory
79
attr_accessor :current_version
810

911
def initialize
10-
@issues_directory = Pathname.new( Redmine::Plugin.registered_plugins[:redmine_spent_time_in_issue_description].directory ).join("app","views","issues")
11-
@current_version = [ Redmine::VERSION::MAJOR, Redmine::VERSION::MINOR, Redmine::VERSION::TINY ].join('.')
12+
plugin_directory = Redmine::Plugin.registered_plugins[:redmine_spent_time_in_issue_description].directory
13+
@issues_directory = Pathname.new(plugin_directory).join('app', 'views', 'issues')
14+
@current_version = [Redmine::VERSION::MAJOR, Redmine::VERSION::MINOR, Redmine::VERSION::TINY].join('.')
1215
end
1316

1417
def show_file
15-
possible_files = @issues_directory.children(false).select{ |files| files.to_s.index(/\d.*show/) }
16-
file = possible_files.sort{|x,y| y <=> x }.find do |file|
18+
possible_files = @issues_directory.children(false).select { |files| files.to_s.index(/\d.*show/) }
19+
show_file = possible_files.sort { |x, y| y <=> x }.find do |file|
1720
version = file.to_s[0..4]
1821
version == @current_version || version < @current_version
1922
end
2023

21-
show_file = @issues_directory.join file unless file.nil?
22-
24+
@issues_directory.join show_file unless show_file.nil?
2325
end
2426

2527
def replace
2628
FileUtils.copy_file show_file.to_s, @issues_directory.join('show.html.erb').to_s
2729
end
28-
2930
end

0 commit comments

Comments
 (0)