summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-30 12:49:26 +0900
committergit <svn-admin@ruby-lang.org>2023-04-25 01:55:56 +0000
commit8b9b075b833f1d5c48b2df75cbf898944ab09664 (patch)
tree5146f50d7c5b283ad4d97e9bd151bf9fe5975d3d /lib
parent85ed226cca1185ddf2fbcd4bf78cbace19e6695f (diff)
downloadruby-8b9b075b833f1d5c48b2df75cbf898944ab09664.tar.gz
[ruby/abbrev] Expose Abbrev::VERSION
https://github.com/ruby/abbrev/commit/255ca681c3
Diffstat (limited to 'lib')
-rw-r--r--lib/abbrev.gemspec11
-rw-r--r--lib/abbrev.rb2
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/abbrev.gemspec b/lib/abbrev.gemspec
index c28b960c8c..50c500bbc7 100644
--- a/lib/abbrev.gemspec
+++ b/lib/abbrev.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 = "abbrev"
- spec.version = "0.1.1"
+ spec.name = name
+ spec.version = version
spec.authors = ["Akinori MUSHA"]
spec.email = ["knu@idaemons.org"]
diff --git a/lib/abbrev.rb b/lib/abbrev.rb
index 2af01d2eae..83dacf081e 100644
--- a/lib/abbrev.rb
+++ b/lib/abbrev.rb
@@ -48,6 +48,8 @@
module Abbrev
+ VERSION = "0.1.1"
+
# Given a set of strings, calculate the set of unambiguous abbreviations for
# those strings, and return a hash where the keys are all the possible
# abbreviations and the values are the full strings.