From 15796ae1e80e32e8a4ff25d6663d89afc00025bb Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 30 Mar 2023 14:08:23 +0900 Subject: [PATCH] [ruby/set] Expose Set::VERSION https://github.com/ruby/set/commit/d39b33f463 --- lib/set.rb | 3 +++ lib/set/set.gemspec | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/set.rb b/lib/set.rb index 95dd9217b1..cf99ffac4b 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -216,6 +216,9 @@ # has been modified while an element in the set. # class Set + + VERSION = "1.0.3" + include Enumerable # Creates a new set containing the given objects. diff --git a/lib/set/set.gemspec b/lib/set/set.gemspec index 1e83287420..c415fac99c 100644 --- a/lib/set/set.gemspec +++ b/lib/set/set.gemspec @@ -1,6 +1,13 @@ +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*VERSION\s*=\s*"(.*)"/ =~ line and break $1 + end rescue nil +end + Gem::Specification.new do |spec| - spec.name = "set" - spec.version = "1.0.3" + spec.name = name + spec.version = version spec.authors = ["Akinori MUSHA"] spec.email = ["knu@idaemons.org"]