uri 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd3d7dc37d0488ad25f3cc84a6c8d75baeafe620393c5853db53658aedd6c848
4
- data.tar.gz: 55418aa52949ba4a07d06a7160c6c238020bf1b94afe5c64ea594485c6b98dee
3
+ metadata.gz: 5e32cdbfcc4ace0d2d7725f91df557f0f63cd09eedbacd13134457b5d6186b6b
4
+ data.tar.gz: a8afae357ba17c192629c04a27c615baac982d83659ed0ad56ec248e53eec823
5
5
  SHA512:
6
- metadata.gz: c1ad53e9f8bfac0f38450e735bd72bfb2ad0fe1a5617d2f4e68a4e6721863cc3fe7965ca8e88b24e928f6f71ed79933ae650b7e3cfa14a12afae0e27e498799a
7
- data.tar.gz: cc76741218cd86803df72dea8f535c537896d3388bcacb9ec29f0a83adf7035a75ee9c501e509ffb53d85903690b38b206e93c11ee2eb94c03aa68811af5d843
6
+ metadata.gz: 5fd294d6b44511a930257f6422525c100c8f5bb3cf9ecc9a8c2afbcda6bd2c863a0ece45450dc0bcb611de7815f8e5dcf398fa1c44f88dfb5df34fc111ffa98a
7
+ data.tar.gz: 022475711eb79ff13b44b19efdba281d50729f5517d01e68da2a6943192546ed2d2cacea17f7b01774e1b4ce8765dbdb79f81390f69f7cbc8d3935947755eca9
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ BSDL
2
+ COPYING
3
+ README.md
4
+ docs/
5
+ lib/
data/.rdoc_options ADDED
@@ -0,0 +1,4 @@
1
+ main_page: README.md
2
+ op_dir: _site
3
+ warn_missing_rdoc_ref: true
4
+ title: URI Documentation
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![CI](https://github.com/ruby/uri/actions/workflows/test.yml/badge.svg)](https://github.com/ruby/uri/actions/workflows/test.yml)
4
4
  [![Yard Docs](https://img.shields.io/badge/docs-exist-blue.svg)](https://ruby.github.io/uri/)
5
5
 
6
- URI is a module providing classes to handle Uniform Resource Identifiers [RFC2396](http://tools.ietf.org/html/rfc2396).
6
+ URI is a module providing classes to handle Uniform Resource Identifiers [RFC3986](http://tools.ietf.org/html/rfc3986).
7
7
 
8
8
  ## Features
9
9
 
data/docs/kernel.rb ADDED
@@ -0,0 +1,2 @@
1
+ # :stopdoc:
2
+ module Kernel end
data/lib/uri/common.rb CHANGED
@@ -13,15 +13,19 @@ require_relative "rfc2396_parser"
13
13
  require_relative "rfc3986_parser"
14
14
 
15
15
  module URI
16
+ # The default parser instance for RFC 2396.
16
17
  RFC2396_PARSER = RFC2396_Parser.new
17
18
  Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
18
19
 
20
+ # The default parser instance for RFC 3986.
19
21
  RFC3986_PARSER = RFC3986_Parser.new
20
22
  Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
21
23
 
24
+ # The default parser instance.
22
25
  DEFAULT_PARSER = RFC3986_PARSER
23
26
  Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
24
27
 
28
+ # Set the default parser instance.
25
29
  def self.parser=(parser = RFC3986_PARSER)
26
30
  remove_const(:Parser) if defined?(::URI::Parser)
27
31
  const_set("Parser", parser.class)
@@ -31,21 +35,16 @@ module URI
31
35
  if Parser == RFC2396_Parser
32
36
  const_set("REGEXP", URI::RFC2396_REGEXP)
33
37
  const_set("PATTERN", URI::RFC2396_REGEXP::PATTERN)
34
- Parser.new.pattern.each_pair do |sym, str|
35
- unless REGEXP::PATTERN.const_defined?(sym)
36
- REGEXP::PATTERN.const_set(sym, str)
37
- end
38
- end
39
38
  end
40
39
 
41
40
  Parser.new.regexp.each_pair do |sym, str|
42
- remove_const(sym) if const_defined?(sym)
41
+ remove_const(sym) if const_defined?(sym, false)
43
42
  const_set(sym, str)
44
43
  end
45
44
  end
46
45
  self.parser = RFC3986_PARSER
47
46
 
48
- def self.const_missing(const)
47
+ def self.const_missing(const) # :nodoc:
49
48
  if const == :REGEXP
50
49
  warn "URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
51
50
  URI::RFC2396_REGEXP
@@ -92,7 +91,7 @@ module URI
92
91
  module_function :make_components_hash
93
92
  end
94
93
 
95
- module Schemes
94
+ module Schemes # :nodoc:
96
95
  end
97
96
  private_constant :Schemes
98
97
 
@@ -310,7 +309,7 @@ module URI
310
309
  256.times do |i|
311
310
  TBLENCWWWCOMP_[-i.chr] = -('%%%02X' % i)
312
311
  end
313
- TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze
312
+ TBLENCURICOMP_ = TBLENCWWWCOMP_.dup.freeze # :nodoc:
314
313
  TBLENCWWWCOMP_[' '] = '+'
315
314
  TBLENCWWWCOMP_.freeze
316
315
  TBLDECWWWCOMP_ = {} # :nodoc:
data/lib/uri/generic.rb CHANGED
@@ -737,12 +737,12 @@ module URI
737
737
  end
738
738
  private :check_registry
739
739
 
740
- def set_registry(v) #:nodoc:
740
+ def set_registry(v) # :nodoc:
741
741
  raise InvalidURIError, "cannot set registry"
742
742
  end
743
743
  protected :set_registry
744
744
 
745
- def registry=(v)
745
+ def registry=(v) # :nodoc:
746
746
  raise InvalidURIError, "cannot set registry"
747
747
  end
748
748
 
@@ -1133,17 +1133,16 @@ module URI
1133
1133
  base.fragment=(nil)
1134
1134
 
1135
1135
  # RFC2396, Section 5.2, 4)
1136
- if !authority
1137
- base.set_path(merge_path(base.path, rel.path)) if base.path && rel.path
1138
- else
1139
- # RFC2396, Section 5.2, 4)
1140
- base.set_path(rel.path) if rel.path
1136
+ if authority
1137
+ base.set_userinfo(rel.userinfo)
1138
+ base.set_host(rel.host)
1139
+ base.set_port(rel.port || base.default_port)
1140
+ base.set_path(rel.path)
1141
+ elsif base.path && rel.path
1142
+ base.set_path(merge_path(base.path, rel.path))
1141
1143
  end
1142
1144
 
1143
1145
  # RFC2396, Section 5.2, 7)
1144
- base.set_userinfo(rel.userinfo) if rel.userinfo
1145
- base.set_host(rel.host) if rel.host
1146
- base.set_port(rel.port) if rel.port
1147
1146
  base.query = rel.query if rel.query
1148
1147
  base.fragment=(rel.fragment) if rel.fragment
1149
1148
 
@@ -1392,10 +1391,12 @@ module URI
1392
1391
  end
1393
1392
  end
1394
1393
 
1394
+ # Returns the hash value.
1395
1395
  def hash
1396
1396
  self.component_ary.hash
1397
1397
  end
1398
1398
 
1399
+ # Compares with _oth_ for Hash.
1399
1400
  def eql?(oth)
1400
1401
  self.class == oth.class &&
1401
1402
  parser == oth.parser &&
@@ -1438,7 +1439,7 @@ module URI
1438
1439
  end
1439
1440
  end
1440
1441
 
1441
- def inspect
1442
+ def inspect # :nodoc:
1442
1443
  "#<#{self.class} #{self}>"
1443
1444
  end
1444
1445
 
@@ -321,14 +321,14 @@ module URI
321
321
  str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
322
322
  end
323
323
 
324
- @@to_s = Kernel.instance_method(:to_s)
325
- if @@to_s.respond_to?(:bind_call)
326
- def inspect
327
- @@to_s.bind_call(self)
324
+ TO_S = Kernel.instance_method(:to_s) # :nodoc:
325
+ if TO_S.respond_to?(:bind_call)
326
+ def inspect # :nodoc:
327
+ TO_S.bind_call(self)
328
328
  end
329
329
  else
330
- def inspect
331
- @@to_s.bind(self).call
330
+ def inspect # :nodoc:
331
+ TO_S.bind(self).call
332
332
  end
333
333
  end
334
334
 
@@ -536,4 +536,11 @@ module URI
536
536
  end
537
537
 
538
538
  end # class Parser
539
+
540
+ # Backward compatibility for URI::REGEXP::PATTERN::*
541
+ RFC2396_Parser.new.pattern.each_pair do |sym, str|
542
+ unless RFC2396_REGEXP::PATTERN.const_defined?(sym, false)
543
+ RFC2396_REGEXP::PATTERN.const_set(sym, str)
544
+ end
545
+ end
539
546
  end # module URI
@@ -142,25 +142,25 @@ module URI
142
142
 
143
143
  # Compatibility for RFC2396 parser
144
144
  def extract(str, schemes = nil, &block) # :nodoc:
145
- warn "URI::RFC3986_PARSER.extract is obsoleted. Use URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE
145
+ warn "URI::RFC3986_PARSER.extract is obsolete. Use URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE
146
146
  RFC2396_PARSER.extract(str, schemes, &block)
147
147
  end
148
148
 
149
149
  # Compatibility for RFC2396 parser
150
150
  def make_regexp(schemes = nil) # :nodoc:
151
- warn "URI::RFC3986_PARSER.make_regexp is obsoleted. Use URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE
151
+ warn "URI::RFC3986_PARSER.make_regexp is obsolete. Use URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE
152
152
  RFC2396_PARSER.make_regexp(schemes)
153
153
  end
154
154
 
155
155
  # Compatibility for RFC2396 parser
156
156
  def escape(str, unsafe = nil) # :nodoc:
157
- warn "URI::RFC3986_PARSER.escape is obsoleted. Use URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE
157
+ warn "URI::RFC3986_PARSER.escape is obsolete. Use URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE
158
158
  unsafe ? RFC2396_PARSER.escape(str, unsafe) : RFC2396_PARSER.escape(str)
159
159
  end
160
160
 
161
161
  # Compatibility for RFC2396 parser
162
162
  def unescape(str, escaped = nil) # :nodoc:
163
- warn "URI::RFC3986_PARSER.unescape is obsoleted. Use URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE
163
+ warn "URI::RFC3986_PARSER.unescape is obsolete. Use URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE
164
164
  escaped ? RFC2396_PARSER.unescape(str, escaped) : RFC2396_PARSER.unescape(str)
165
165
  end
166
166
 
data/lib/uri/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module URI
2
2
  # :stopdoc:
3
- VERSION_CODE = '010001'.freeze
3
+ VERSION_CODE = '010003'.freeze
4
4
  VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
5
5
  # :startdoc:
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Yamada
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-08 00:00:00.000000000 Z
11
+ date: 2025-02-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: URI is a module providing classes to handle Uniform Resource Identifiers
14
14
  email:
@@ -17,18 +17,12 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - ".github/dependabot.yml"
21
- - ".github/workflows/gh-pages.yml"
22
- - ".github/workflows/push_gem.yml"
23
- - ".github/workflows/test.yml"
24
- - ".gitignore"
20
+ - ".document"
21
+ - ".rdoc_options"
25
22
  - BSDL
26
23
  - COPYING
27
- - Gemfile
28
24
  - README.md
29
- - Rakefile
30
- - bin/console
31
- - bin/setup
25
+ - docs/kernel.rb
32
26
  - lib/uri.rb
33
27
  - lib/uri/common.rb
34
28
  - lib/uri/file.rb
@@ -44,8 +38,6 @@ files:
44
38
  - lib/uri/version.rb
45
39
  - lib/uri/ws.rb
46
40
  - lib/uri/wss.rb
47
- - rakelib/sync_tool.rake
48
- - uri.gemspec
49
41
  homepage: https://github.com/ruby/uri
50
42
  licenses:
51
43
  - Ruby
@@ -56,7 +48,7 @@ metadata:
56
48
  documentation_uri: https://ruby.github.io/uri/
57
49
  homepage_uri: https://github.com/ruby/uri
58
50
  source_code_uri: https://github.com/ruby/uri
59
- post_install_message:
51
+ post_install_message:
60
52
  rdoc_options: []
61
53
  require_paths:
62
54
  - lib
@@ -72,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
64
  version: '0'
73
65
  requirements: []
74
66
  rubygems_version: 3.5.11
75
- signing_key:
67
+ signing_key:
76
68
  specification_version: 4
77
69
  summary: URI is a module providing classes to handle Uniform Resource Identifiers
78
70
  test_files: []
@@ -1,6 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: 'github-actions'
4
- directory: '/'
5
- schedule:
6
- interval: 'weekly'
@@ -1,46 +0,0 @@
1
- name: Deploy RDoc site to Pages
2
-
3
- on:
4
- push:
5
- branches: [ 'master' ]
6
- workflow_dispatch:
7
-
8
- permissions:
9
- contents: read
10
- pages: write
11
- id-token: write
12
-
13
- concurrency:
14
- group: "pages"
15
- cancel-in-progress: true
16
-
17
- jobs:
18
- build:
19
- runs-on: ubuntu-latest
20
- steps:
21
- - name: Checkout
22
- uses: actions/checkout@v4
23
- - name: Setup Ruby
24
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
25
- with:
26
- ruby-version: '3.3'
27
- bundler-cache: true
28
- - name: Setup Pages
29
- id: pages
30
- uses: actions/configure-pages@v5
31
- - name: Build with RDoc
32
- # Outputs to the './_site' directory by default
33
- run: bundle exec rake rdoc
34
- - name: Upload artifact
35
- uses: actions/upload-pages-artifact@v3
36
-
37
- deploy:
38
- environment:
39
- name: github-pages
40
- url: ${{ steps.deployment.outputs.page_url }}
41
- runs-on: ubuntu-latest
42
- needs: build
43
- steps:
44
- - name: Deploy to GitHub Pages
45
- id: deployment
46
- uses: actions/deploy-pages@v4
@@ -1,46 +0,0 @@
1
- name: Publish gem to rubygems.org
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*'
7
-
8
- permissions:
9
- contents: read
10
-
11
- jobs:
12
- push:
13
- if: github.repository == 'ruby/uri'
14
- runs-on: ubuntu-latest
15
-
16
- environment:
17
- name: rubygems.org
18
- url: https://rubygems.org/gems/uri
19
-
20
- permissions:
21
- contents: write
22
- id-token: write
23
-
24
- steps:
25
- - name: Harden Runner
26
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
27
- with:
28
- egress-policy: audit
29
-
30
- - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
31
-
32
- - name: Set up Ruby
33
- uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
34
- with:
35
- bundler-cache: true
36
- ruby-version: ruby
37
-
38
- - name: Publish to RubyGems
39
- uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1
40
-
41
- - name: Create GitHub release
42
- run: |
43
- tag_name="$(git describe --tags --abbrev=0)"
44
- gh release create "${tag_name}" --verify-tag --generate-notes
45
- env:
46
- GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}
@@ -1,30 +0,0 @@
1
- name: CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- ruby-versions:
7
- uses: ruby/actions/.github/workflows/ruby_versions.yml@master
8
- with:
9
- min_version: 2.5
10
-
11
- build:
12
- needs: ruby-versions
13
- name: build (${{ matrix.ruby }} / ${{ matrix.os }})
14
- strategy:
15
- matrix:
16
- ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
17
- os: [ ubuntu-latest, macos-latest ]
18
- exclude:
19
- - ruby: 2.5
20
- os: macos-latest
21
- runs-on: ${{ matrix.os }}
22
- steps:
23
- - uses: actions/checkout@v4
24
- - name: Set up Ruby
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: ${{ matrix.ruby }}
28
- - run: bundle install --jobs 4 --retry 3
29
- - name: Run test
30
- run: rake test
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
10
- /_site
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem "bundler"
7
- gem "rake"
8
- gem "test-unit"
9
- gem "test-unit-ruby-core"
10
- end
data/Rakefile DELETED
@@ -1,18 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test/lib"
6
- t.ruby_opts << "-rhelper"
7
- t.test_files = FileList["test/**/test_*.rb"]
8
- end
9
-
10
- require "rdoc/task"
11
- RDoc::Task.new do |doc|
12
- doc.main = "README.md"
13
- doc.title = "URI - handle Uniform Resource Identifiers"
14
- doc.rdoc_files = FileList.new %w[lib README.md LICENSE.txt]
15
- doc.rdoc_dir = "_site" # for github pages
16
- end
17
-
18
- task :default => :test
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "uri"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,17 +0,0 @@
1
- task :sync_tool, [:from] do |t, from: nil|
2
- from ||= (File.identical?(__dir__, "rakelib") ? "../ruby/tool" : File.dirname(__dir__))
3
-
4
- require 'fileutils'
5
-
6
- {
7
- "rakelib/sync_tool.rake" => "rakelib",
8
- "lib/core_assertions.rb" => "test/lib",
9
- "lib/envutil.rb" => "test/lib",
10
- "lib/find_executable.rb" => "test/lib",
11
- "lib/helper.rb" => "test/lib",
12
- }.each do |src, dest|
13
- FileUtils.mkpath(dest)
14
- FileUtils.cp "#{from}/#{src}", dest
15
- rescue Errno::ENOENT
16
- end
17
- end
data/uri.gemspec DELETED
@@ -1,39 +0,0 @@
1
- begin
2
- require_relative "lib/uri/version"
3
- rescue LoadError # Fallback to load version file in ruby core repository
4
- require_relative "version"
5
- end
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "uri"
9
- spec.version = URI::VERSION
10
- spec.authors = ["Akira Yamada"]
11
- spec.email = ["akira@ruby-lang.org"]
12
-
13
- spec.summary = %q{URI is a module providing classes to handle Uniform Resource Identifiers}
14
- spec.description = spec.summary
15
-
16
- github_link = "https://github.com/ruby/uri"
17
-
18
- spec.homepage = github_link
19
- spec.licenses = ["Ruby", "BSD-2-Clause"]
20
-
21
- spec.required_ruby_version = '>= 2.5'
22
-
23
- spec.metadata = {
24
- "bug_tracker_uri" => "#{github_link}/issues",
25
- "changelog_uri" => "#{github_link}/releases",
26
- "documentation_uri" => "https://ruby.github.io/uri/",
27
- "homepage_uri" => spec.homepage,
28
- "source_code_uri" => github_link
29
- }
30
-
31
- # Specify which files should be added to the gem when it is released.
32
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
34
- `git ls-files -z 2>#{IO::NULL}`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
- end
36
- spec.bindir = "exe"
37
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
- spec.require_paths = ["lib"]
39
- end