urlpattern 0.1.0 → 0.1.1

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: 4087f8d670ecc5bb3901622507f4c30faa19cf3c45411eb16ac105bd17f88bdb
4
- data.tar.gz: 38229915a8d7bcabbb6b29c42055f7c0cc3bcfe4ec1a6f855a550a2b0824af79
3
+ metadata.gz: c40ee2230fea1701cf0e24f3b5b7d3701dd44c1144109be76332ea25b04450ba
4
+ data.tar.gz: 9f190639b5226254b00d6f2d8b9b1cc20bf78bd9e56a2fce518571d2eb685a99
5
5
  SHA512:
6
- metadata.gz: e6343f07b3d32ddaf1e61b5d9c3a44df9f921afd698695eb411ed85a55884f301da904dbb8560561a6acc64fff1dea128cb7754bf27f8c4d81cf9e88315029c3
7
- data.tar.gz: 41e2c84cf4929d2a05a729ad93af724d1b468993541bff10423b548a65808decef08fb0f94876fa99f4b369b7f6cb997652d2f5507b246943908c56fb52116a5
6
+ metadata.gz: af8101a053b47f4c5d2bd074e9d0586dc8ac90ba205ef75831de8fcacd3f295fc6f61441cda98d82a41131c949a4dc4f3cb7d48c7da39d04ad191ef4d8eb64df
7
+ data.tar.gz: a8a692f3c4415840b68d65a81ed80e0f521ce2274400d352bbe8cb2152dcb47444eb829cef1ec1bf81ed7baf2971a4d2f2e9a580bc93d143e6b938a444f9c4d0
data/Cargo.lock CHANGED
@@ -31,9 +31,9 @@ dependencies = [
31
31
 
32
32
  [[package]]
33
33
  name = "bitflags"
34
- version = "2.11.0"
34
+ version = "2.11.1"
35
35
  source = "registry+https://github.com/rust-lang/crates.io-index"
36
- checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
36
+ checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
37
37
 
38
38
  [[package]]
39
39
  name = "cexpr"
@@ -213,9 +213,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
213
213
 
214
214
  [[package]]
215
215
  name = "libc"
216
- version = "0.2.184"
216
+ version = "0.2.185"
217
217
  source = "registry+https://github.com/rust-lang/crates.io-index"
218
- checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
218
+ checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f"
219
219
 
220
220
  [[package]]
221
221
  name = "libloading"
@@ -313,18 +313,18 @@ dependencies = [
313
313
 
314
314
  [[package]]
315
315
  name = "rb-sys"
316
- version = "0.9.126"
316
+ version = "0.9.127"
317
317
  source = "registry+https://github.com/rust-lang/crates.io-index"
318
- checksum = "284799e73e899fe946fd77c7211b83bff61a1356e039ade7a2516a779e3212d0"
318
+ checksum = "d7d7c9560fe42dcffa576941394075f18a17dce89fcf718a2fa90b7dc2134d12"
319
319
  dependencies = [
320
320
  "rb-sys-build",
321
321
  ]
322
322
 
323
323
  [[package]]
324
324
  name = "rb-sys-build"
325
- version = "0.9.126"
325
+ version = "0.9.127"
326
326
  source = "registry+https://github.com/rust-lang/crates.io-index"
327
- checksum = "855fc1ad8943d12c89ef12f9147f1cc531f5bf19fb744112fdd317bb6ee7b5c5"
327
+ checksum = "f1688e8f32967ba48c89e4dfa283b57f901075f542fc7ee9c3d7c5f9091ca1d9"
328
328
  dependencies = [
329
329
  "bindgen",
330
330
  "lazy_static",
@@ -509,7 +509,7 @@ dependencies = [
509
509
 
510
510
  [[package]]
511
511
  name = "urlpattern"
512
- version = "0.1.0"
512
+ version = "0.1.1"
513
513
  dependencies = [
514
514
  "magnus",
515
515
  "rb-sys",
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # urlpattern
2
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
+
3
7
  An implementation of [the URL Pattern Standard](https://urlpattern.spec.whatwg.org/) for Ruby written in Rust.
4
8
 
5
9
  ## Description
@@ -10,23 +14,74 @@ It is useful on the server side when serving different pages based on the URL (a
10
14
 
11
15
  ## Installation
12
16
 
13
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
14
-
15
17
  Install the gem and add to the application's Gemfile by executing:
16
18
 
17
19
  ```bash
18
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
20
+ bundle add urlpattern
19
21
  ```
20
22
 
21
23
  If bundler is not being used to manage dependencies, install the gem by executing:
22
24
 
23
25
  ```bash
24
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
26
+ gem install urlpattern
25
27
  ```
26
28
 
27
29
  ## Usage
28
30
 
29
- TODO: Write usage instructions here
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).
30
85
 
31
86
  ## Development
32
87
 
data/Rakefile CHANGED
@@ -19,4 +19,9 @@ RbSys::ExtensionTask.new("urlpattern", GEMSPEC) do |ext|
19
19
  ext.lib_dir = "lib/urlpattern"
20
20
  end
21
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
+
22
27
  task default: %i[compile test rubocop]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "urlpattern"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  edition = "2024"
5
5
  authors = ["방성범 (Bang Seongbeom) <bangseongbeom@gmail.com>"]
6
6
  license = "MIT"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module URLPattern
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urlpattern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 방성범 (Bang Seongbeom)
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.9.91
18
+ version: 0.9.127
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.9.91
25
+ version: 0.9.127
26
26
  description: |
27
27
  It's a thin wrapper of denoland/rust-urlpattern with Magnus.
28
28