Skip to content

Commit ee9a193

Browse files
committed
Populate RBS
1 parent 6cb9ed7 commit ee9a193

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

sig/urlpattern.rbs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,63 @@
11
module URLPattern
22
VERSION: String
33
# 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[String, String?]
60+
}
61+
62+
type urlpattern_compatible = String | urlpattern_init | URLPattern
463
end

0 commit comments

Comments
 (0)