urlpattern 0.1.0-aarch64-linux

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fcb17c4951b15a973f84aea5a82b1d754dd31b31b76aa7ea95bc8bc5834a4160
4
+ data.tar.gz: cb5c07e9b8618c5e2c14d6feeb67bc9ca42ac58eb3299154d7a57d03c894432e
5
+ SHA512:
6
+ metadata.gz: 42305546c28c223470a669267d92788103a8769f8eca189246e1fefe3684ac8823d4126d660a73d1d46b23641eff534a16776d8c5948f43741b0185faa3232ee
7
+ data.tar.gz: c0906f136d9d6385e5a3279755ab1436572182d7fbc74896414555e62d42f145f46aaffeb1bba7b370bb9c9bb347ecc4cf580c72c5141bca6b936c2c182ad111
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "urlpattern" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["bangseongbeom@gmail.com"](mailto:"bangseongbeom@gmail.com").
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 방성범 (Bang Seongbeom)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # urlpattern
2
+
3
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
4
+ [![Gem Version](https://badge.fury.io/rb/urlpattern.svg)](https://badge.fury.io/rb/urlpattern)
5
+ [![Ruby](https://github.com/urlpattern/ruby-urlpattern/actions/workflows/main.yml/badge.svg)](https://github.com/urlpattern/ruby-urlpattern/actions/workflows/main.yml)
6
+
7
+ An implementation of [the URL Pattern Standard](https://urlpattern.spec.whatwg.org/) for Ruby written in Rust.
8
+
9
+ ## Description
10
+
11
+ It's a thin wrapper of [denoland/rust-urlpattern](https://github.com/denoland/rust-urlpattern) with [Magnus](https://github.com/matsadler/magnus).
12
+
13
+ It is useful on the server side when serving different pages based on the URL (a.k.a. routing). It provides pattern matching syntax like `/users/:id`, similar to [route parameters in Express](https://expressjs.com/en/guide/routing.html#route-parameters) or [Path-to-RegExp](https://github.com/pillarjs/path-to-regexp). You can use it as a foundation to build your own web server or framework.
14
+
15
+ ## Installation
16
+
17
+ Install the gem and add to the application's Gemfile by executing:
18
+
19
+ ```bash
20
+ bundle add urlpattern
21
+ ```
22
+
23
+ If bundler is not being used to manage dependencies, install the gem by executing:
24
+
25
+ ```bash
26
+ gem install urlpattern
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ This library aims to expose an interface as close as possible to the URL Pattern Standard, but some differences are unavoidable because it is designed for Ruby, not JavaScript. For the exact details, please refer to [urlpattern.rbs](https://github.com/urlpattern/ruby-urlpattern/blob/main/sig/urlpattern.rbs).
32
+
33
+ Most JavaScript examples from [Chrome for Developers](https://developer.chrome.com/docs/web-platform/urlpattern) and [MDN](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) can be adapted to Ruby without much difficulty.
34
+
35
+ ### `test`
36
+
37
+ ```rb
38
+ require "urlpattern"
39
+
40
+ pattern = URLPattern::URLPattern.new "https://example.com/admin/*"
41
+ pattern.test? "https://example.com/admin/main/" #=> true
42
+ pattern.test? "https://example.com/main/" #=> false
43
+ ```
44
+
45
+ ### `exec`
46
+
47
+ ```rb
48
+ require "urlpattern"
49
+
50
+ pattern = URLPattern::URLPattern.new pathname: "/users/:id/"
51
+ result = pattern.exec pathname: "/users/4163/"
52
+ result[:pathname][:groups][:id] #=> 4163
53
+ ```
54
+
55
+ ### `base_url`
56
+
57
+ ```rb
58
+ require "urlpattern"
59
+
60
+ pattern = URLPattern::URLPattern.new "b", "https://example.com/a/"
61
+ pattern.test? "a/b", "https://example.com/" #=> true
62
+ pattern.test? "b", "https://example.com/a/" #=> true
63
+ pattern.test? pathname: "b", base_url: "https://example.com/a/" #=> true
64
+ ```
65
+
66
+ ### `ignore_case`
67
+
68
+ ```rb
69
+ require "urlpattern"
70
+
71
+ pattern = URLPattern::URLPattern.new "https://example.com/test"
72
+ pattern.test? "https://example.com/test" #=> true
73
+ pattern.test? "https://example.com/TeST" #=> false
74
+
75
+ pattern = URLPattern::URLPattern.new "https://example.com/test", ignore_case: true
76
+ pattern.test? "https://example.com/test" #=> true
77
+ pattern.test? "https://example.com/TeST" #=> true
78
+ ```
79
+
80
+ ## Limitations
81
+
82
+ Due to limitations in the dependency [denoland/rust-urlpattern](https://github.com/denoland/rust-urlpattern), it may not support all features specified in [the standard](https://urlpattern.spec.whatwg.org/).
83
+
84
+ Check `skip` in [`test/test_urlpattern.rb`](https://github.com/urlpattern/ruby-urlpattern/blob/main/test/test_urlpattern.rb).
85
+
86
+ ## Development
87
+
88
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
89
+
90
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
91
+
92
+ ## Contributing
93
+
94
+ Bug reports and pull requests are welcome on GitHub at https://github.com/urlpattern/ruby-urlpattern. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/urlpattern/ruby-urlpattern/blob/main/CODE_OF_CONDUCT.md).
95
+
96
+ ## License
97
+
98
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
99
+
100
+ ## Code of Conduct
101
+
102
+ Everyone interacting in the Urlpattern project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/urlpattern/ruby-urlpattern/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ require "rb_sys/extensiontask"
13
+
14
+ task build: :compile
15
+
16
+ GEMSPEC = Gem::Specification.load("urlpattern.gemspec")
17
+
18
+ RbSys::ExtensionTask.new("urlpattern", GEMSPEC) do |ext|
19
+ ext.lib_dir = "lib/urlpattern"
20
+ end
21
+
22
+ Rake::Task["release:rubygem_push"].clear
23
+ task "release:rubygem_push" do
24
+ Dir["pkg/*.gem"].each { |gem| sh "gem", "push", gem }
25
+ end
26
+
27
+ task default: %i[compile test rubocop]
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module URLPattern
4
+ VERSION = "0.1.0"
5
+ end
data/lib/urlpattern.rb ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "urlpattern/version"
4
+ require "urlpattern/urlpattern"
@@ -0,0 +1,63 @@
1
+ module URLPattern
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+
5
+ class Error < StandardError
6
+ end
7
+
8
+ type urlpattern_input = String | urlpattern_init
9
+
10
+ class URLPattern
11
+ def initialize: (urlpattern_input input, String base_url, ?urlpattern_options options) -> void
12
+ | (?urlpattern_input input, ?urlpattern_options options) -> void
13
+
14
+ def test?: (?urlpattern_input input, ?String base_url) -> bool
15
+
16
+ def exec: (?urlpattern_input input, ?String base_url) -> urlpattern_result?
17
+
18
+ def protocol: () -> String
19
+ def username: () -> String
20
+ def password: () -> String
21
+ def hostname: () -> String
22
+ def port: () -> String
23
+ def pathname: () -> String
24
+ def search: () -> String
25
+ def hash: () -> String
26
+ def has_regexp_groups?: () -> bool
27
+ end
28
+
29
+ type urlpattern_init = {
30
+ ?protocol: String,
31
+ ?username: String,
32
+ ?password: String,
33
+ ?hostname: String,
34
+ ?port: String,
35
+ ?pathname: String,
36
+ ?search: String,
37
+ ?hash: String,
38
+ ?base_url: String
39
+ }
40
+
41
+ type urlpattern_options = {
42
+ ?ignore_case: bool
43
+ }
44
+
45
+ type urlpattern_result = {
46
+ ?inputs: Array[urlpattern_input],
47
+ ?protocol: urlpattern_component_result,
48
+ ?username: urlpattern_component_result,
49
+ ?password: urlpattern_component_result,
50
+ ?hostname: urlpattern_component_result,
51
+ ?port: urlpattern_component_result,
52
+ ?pathname: urlpattern_component_result,
53
+ ?search: urlpattern_component_result,
54
+ ?hash: urlpattern_component_result
55
+ }
56
+
57
+ type urlpattern_component_result = {
58
+ ?input: String,
59
+ ?groups: Hash[Symbol, String?]
60
+ }
61
+
62
+ type urlpattern_compatible = String | urlpattern_init | URLPattern
63
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: urlpattern
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: aarch64-linux
6
+ authors:
7
+ - 방성범 (Bang Seongbeom)
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-04-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ It's a thin wrapper of denoland/rust-urlpattern with Magnus.
15
+
16
+ It is useful on the server side when serving different pages based on the URL (a.k.a. routing). It provides pattern matching syntax like /users/:id, similar to route parameters in Express or Path-to-RegExp. You can use it as a foundation to build your own web server or framework.
17
+ email:
18
+ - bangseongbeom@gmail.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - CODE_OF_CONDUCT.md
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - lib/urlpattern.rb
28
+ - lib/urlpattern/3.0/urlpattern.so
29
+ - lib/urlpattern/3.1/urlpattern.so
30
+ - lib/urlpattern/3.2/urlpattern.so
31
+ - lib/urlpattern/3.3/urlpattern.so
32
+ - lib/urlpattern/3.4/urlpattern.so
33
+ - lib/urlpattern/4.0/urlpattern.so
34
+ - lib/urlpattern/version.rb
35
+ - sig/urlpattern.rbs
36
+ homepage: https://github.com/urlpattern/ruby-urlpattern
37
+ licenses:
38
+ - MIT
39
+ metadata:
40
+ homepage_uri: https://github.com/urlpattern/ruby-urlpattern
41
+ source_code_uri: https://github.com/urlpattern/ruby-urlpattern
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
51
+ - - "<"
52
+ - !ruby/object:Gem::Version
53
+ version: 4.1.dev
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.5.23
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: An implementation of the URL Pattern Standard for Ruby written in Rust.
64
+ test_files: []