From a27bb8e10786efa4776cc3ecfe12490e1ea106a7 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 14 Mar 2024 18:07:57 +0900 Subject: [PATCH 1/2] Use Struct instead of OpenStruct. I will migrate osturct as bundled gems at Ruby 3.5. We should remove its dependency from Rake --- lib/rake.rb | 1 - lib/rake/application.rb | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/rake.rb b/lib/rake.rb index 0dfd05315..0f3d6a330 100644 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -30,7 +30,6 @@ module Rake; end require "singleton" require "monitor" require "optparse" -require "ostruct" require "rake/ext/string" diff --git a/lib/rake/application.rb b/lib/rake/application.rb index ac5714b11..143c96f03 100644 --- a/lib/rake/application.rb +++ b/lib/rake/application.rb @@ -165,7 +165,15 @@ def add_loader(ext, loader) # Application options from the command line def options - @options ||= OpenStruct.new + return @options if @options + + @options = Struct.new( + :always_multitask, :backtrace, :build_all, :dryrun, + :ignore_deprecate, :ignore_system, :job_stats, :load_system, + :nosearch, :rakelib, :show_all_tasks, :show_prereqs, + :show_task_pattern, :show_tasks, :silent, :suppress_backtrace_pattern, + :thread_pool_size, :trace, :trace_output, :trace_rules + ).new end # Return the thread pool used for multithreaded processing. From f4d6eebb6d886d23496f45ee088e024f33c25ada Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 14 Mar 2024 18:22:04 +0900 Subject: [PATCH 2/2] Avoid to warning for variable initialization --- lib/rake/application.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/rake/application.rb b/lib/rake/application.rb index 143c96f03..b5631cdf6 100644 --- a/lib/rake/application.rb +++ b/lib/rake/application.rb @@ -165,9 +165,7 @@ def add_loader(ext, loader) # Application options from the command line def options - return @options if @options - - @options = Struct.new( + @options ||= Struct.new( :always_multitask, :backtrace, :build_all, :dryrun, :ignore_deprecate, :ignore_system, :job_stats, :load_system, :nosearch, :rakelib, :show_all_tasks, :show_prereqs,