[ruby/optparse] We should use VERSION instead of Version constant

https://github.com/ruby/optparse/commit/94de48b47e
This commit is contained in:
Hiroshi SHIBATA 2025-10-31 12:05:15 +09:00 committed by git
parent 5b2707f39b
commit 2eae704938
2 changed files with 3 additions and 2 deletions

View File

@ -426,7 +426,8 @@ require 'set' unless defined?(Set)
#
class OptionParser
# The version string
OptionParser::Version = "0.7.0.dev.2"
VERSION = "0.7.0.dev.2"
Version = VERSION # for compatibility
# :stopdoc:
NoArgument = [NO_ARGUMENT = :NONE, nil].freeze

View File

@ -3,7 +3,7 @@
name = File.basename(__FILE__, ".gemspec")
version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
/^\s*OptionParser::Version\s*=\s*"(.*)"/ =~ line and break $1
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
end rescue nil
end