From 32b5992c22415ab667d78e0ef88089b0e0bf456e Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Thu, 11 Jul 2024 08:48:35 +0000 Subject: Fix RuboCop offense Style/MapCompactWithConditionalBlock (#39887). git-svn-id: https://svn.redmine.org/redmine/trunk@22919 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/plugin.rb | 10 +++++----- lib/redmine/themes.rb | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 17a20f5a8..3e442cd12 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -191,11 +191,11 @@ module Redmine end def asset_paths - if path.has_assets_dir? - base_dir = Pathname.new(path.assets_dir) - paths = base_dir.children.filter_map{|child| child if child.directory? } - Redmine::AssetPath.new(base_dir, paths, asset_prefix) - end + return unless path.has_assets_dir? + + base_dir = Pathname.new(path.assets_dir) + paths = base_dir.children.select(&:directory?) + Redmine::AssetPath.new(base_dir, paths, asset_prefix) end def <=>(plugin) diff --git a/lib/redmine/themes.rb b/lib/redmine/themes.rb index 191bafc21..80e846550 100644 --- a/lib/redmine/themes.rb +++ b/lib/redmine/themes.rb @@ -112,10 +112,10 @@ module Redmine def asset_paths base_dir = Pathname.new(path) - paths = base_dir.children.filter_map do |child| - child if child.directory? && - child.basename.to_s != "src" && - !child.basename.to_s.start_with?('.') + paths = base_dir.children.select do |child| + child.directory? && + child.basename.to_s != 'src' && + !child.basename.to_s.start_with?('.') end Redmine::AssetPath.new(base_dir, paths, asset_prefix) end -- cgit v1.2.3