diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-03-30 13:06:08 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-04-03 02:45:42 +0000 |
commit | 14f442a9584989805be8e40caa0de7758bf07532 (patch) | |
tree | 1107dda12b555abe7a4675106bb4d78ae7c27e10 | |
parent | ba4f01f0a03403bea72b129e5935f5a4b79b9402 (diff) |
[ruby/base64] Expose Base64::VERSION
https://github.com/ruby/base64/commit/dda85a0839
-rw-r--r-- | lib/base64.gemspec | 11 | ||||
-rw-r--r-- | lib/base64.rb | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/base64.gemspec b/lib/base64.gemspec index daa0b7fa14..d793dce063 100644 --- a/lib/base64.gemspec +++ b/lib/base64.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 = "base64" - spec.version = "0.1.1" + spec.name = name + spec.version = version spec.authors = ["Yusuke Endoh"] spec.email = ["[email protected]"] diff --git a/lib/base64.rb b/lib/base64.rb index 693aa1f519..15c0b297ce 100644 --- a/lib/base64.rb +++ b/lib/base64.rb @@ -22,6 +22,9 @@ # binary data into purely printable characters. module Base64 + + VERSION = "0.1.1" + module_function # Returns the Base64-encoded version of +bin+. |