From c069ea3a2440f4cb0641abd4e3ddb6be5bd6bdb2 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 20 Aug 2024 23:40:58 +0000 Subject: Use Array#intersect? introduced in Ruby 3.1 (#38585). git-svn-id: https://svn.redmine.org/redmine/trunk@22972 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/acts/positioned.rb | 2 +- lib/redmine/helpers/gantt.rb | 2 +- lib/redmine/wiki_formatting.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/redmine/acts/positioned.rb b/lib/redmine/acts/positioned.rb index adcbac8b9..efb9d2d60 100644 --- a/lib/redmine/acts/positioned.rb +++ b/lib/redmine/acts/positioned.rb @@ -100,7 +100,7 @@ module Redmine end def position_scope_changed? - (saved_changes.keys & self.class.positioned_options[:scope].map(&:to_s)).any? + saved_changes.keys.intersect?(self.class.positioned_options[:scope].map(&:to_s)) end def shift_positions diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 6802c4342..ad676ec6f 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -768,7 +768,7 @@ module Redmine children = object.leaf? ? [] : object.children & project_issues(object.project) has_children = children.present? && - (children.collect(&:fixed_version).uniq & [object.fixed_version]).present? + children.collect(&:fixed_version).uniq.intersect?([object.fixed_version]) when Version tag_options[:id] = "version-#{object.id}" tag_options[:class] = "version-name" diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index cc68e9972..558d3e117 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -103,7 +103,7 @@ module Redmine # Returns true if the text formatter supports single section edit def supports_section_edit? - (formatter.instance_methods & ['update_section', :update_section]).any? + formatter.instance_methods.intersect?(['update_section', :update_section]) end # Returns a cache key for the given text +format+, +text+, +object+ and +attribute+ or nil if no caching should be done -- cgit v1.2.3