summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-13 18:34:43 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-13 18:51:18 +0900
commitf09638fe25d86c4d619a1f45b1595c8a30c54cc4 (patch)
tree8f09f640efa93ff666a0d4f0ed9cc815d484e0c8 /lib
parentcf77f7b5e72ed33516b93b5a20427e7a64475bef (diff)
downloadruby-f09638fe25d86c4d619a1f45b1595c8a30c54cc4.tar.gz
[ruby/time] Expose Time::VERSION
https://github.com/ruby/time/commit/32793b56b7
Diffstat (limited to 'lib')
-rw-r--r--lib/time.gemspec11
-rw-r--r--lib/time.rb3
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/time.gemspec b/lib/time.gemspec
index ce5f76f8e9..a9349a253f 100644
--- a/lib/time.gemspec
+++ b/lib/time.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 = "time"
- spec.version = "0.2.2"
+ spec.name = name
+ spec.version = version
spec.authors = ["Tanaka Akira"]
spec.email = ["akr@fsij.org"]
diff --git a/lib/time.rb b/lib/time.rb
index 6a13212a49..c572e76d7d 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -25,6 +25,9 @@ require 'date'
# :startdoc:
class Time
+
+ VERSION = "0.2.2"
+
class << Time
#