Fix RuboCop offense Style/MapCompactWithConditionalBlock (#39887).

git-svn-id: https://svn.redmine.org/redmine/trunk@22919 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-07-11 08:48:35 +00:00
parent 21e657f572
commit 32b5992c22
3 changed files with 10 additions and 10 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -22,7 +22,7 @@ require_relative '../../../test_helper'
class Redmine::AssetPathTest < ActiveSupport::TestCase
def setup
assets_dir = Rails.root.join('test/fixtures/asset_path/foo')
paths = assets_dir.children.filter_map{|child| child if child.directory? && !child.basename.to_s.starts_with?(".")}
paths = assets_dir.children.select { |child| child.directory? && !child.basename.to_s.starts_with?('.') }
@asset_path = Redmine::AssetPath.new(assets_dir, paths, 'plugin_assets/foo/')
@assets = {}
@transition_map = {}