summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-30 13:14:25 +0900
committergit <svn-admin@ruby-lang.org>2023-04-13 09:47:40 +0000
commit61bd69470a68354b77fad65119c56cbf19f2c152 (patch)
treec3a26823c7f3a250c23ee80b94031f48285a0a6a /lib
parent76aaaf6434752b5dc407878a5268892f859b2bf5 (diff)
downloadruby-61bd69470a68354b77fad65119c56cbf19f2c152.tar.gz
[ruby/open-uri] Expose OpenURI::VERSION
https://github.com/ruby/open-uri/commit/666768d960
Diffstat (limited to 'lib')
-rw-r--r--lib/open-uri.gemspec11
-rw-r--r--lib/open-uri.rb3
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/open-uri.gemspec b/lib/open-uri.gemspec
index cad63e4d80..b6aaf35200 100644
--- a/lib/open-uri.gemspec
+++ b/lib/open-uri.gemspec
@@ -1,6 +1,13 @@
+name = File.basename(__FILE__, ".gemspec")
+version = ["lib", "."].find do |dir|
+ break File.foreach(File.join(__dir__, dir, "#{name}.rb")) do |line|
+ /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
+ end rescue nil
+end
+
Gem::Specification.new do |spec|
- spec.name = "open-uri"
- spec.version = "0.3.0"
+ spec.name = name
+ spec.version = version
spec.authors = ["Tanaka Akira"]
spec.email = ["akr@fsij.org"]
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 93e8cfcdb7..0052bb49fb 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -89,6 +89,9 @@ end
# Author:: Tanaka Akira <akr@m17n.org>
module OpenURI
+
+ VERSION = "0.3.0"
+
Options = {
:proxy => true,
:proxy_http_basic_authentication => true,