summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2023-03-30 13:24:34 +0900
committergit <[email protected]>2023-04-14 01:52:08 +0000
commit6beb755d810082ea3f557f54c687bc752a11cc7b (patch)
tree7cdcc352e04d71226a23380e333c9d009c3d4d05 /lib
parent3f8756484f221625bf7069f46bd876bfe3645940 (diff)
[ruby/prettyprint] Expose PrettyPrint::VERSION
https://github.com/ruby/prettyprint/commit/c6f3947e96
Diffstat (limited to 'lib')
-rw-r--r--lib/prettyprint.gemspec11
-rw-r--r--lib/prettyprint.rb2
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/prettyprint.gemspec b/lib/prettyprint.gemspec
index eae2227d60..a18adb174b 100644
--- a/lib/prettyprint.gemspec
+++ b/lib/prettyprint.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 = "prettyprint"
- spec.version = "0.1.1"
+ spec.name = name
+ spec.version = version
spec.authors = ["Tanaka Akira"]
spec.email = ["[email protected]"]
diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb
index 188c2e6db0..540b12fb70 100644
--- a/lib/prettyprint.rb
+++ b/lib/prettyprint.rb
@@ -33,6 +33,8 @@
#
class PrettyPrint
+ VERSION = "0.1.1"
+
# This is a convenience method which is same as follows:
#
# begin