mustermann 3.0.1 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bench/uri_parser_object.rb +16 -0
- data/lib/mustermann/ast/translator.rb +4 -1
- data/lib/mustermann/pattern.rb +1 -1
- data/lib/mustermann/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eab7afe8e103bc21ee7dbf141e56ec0a086f3225f3ecfd1031afe7e0ed6425e
|
4
|
+
data.tar.gz: 4e7fdee86cb855b82741ed15aac5464611f683b7bd4eca83326dfb08e708f816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12dd15e15b97f1d399d7ccecdc343e741aded6aa095b7c69a174e34b64db15075b106bd23179e0d2023f8f1efd817379322afe7036b94fbb76d35d5b7c33348d
|
7
|
+
data.tar.gz: 21362bc9a0145ed898156c2f0793b9092a76c49ca2fd3d0760b309507cfff61fb324363babd34759d46b67462ea66dc686a18aff1324ad5de20bee9c09b0e43f
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "objspace"
|
2
|
+
require "uri"
|
3
|
+
require_relative "../lib/mustermann/ast/translator"
|
4
|
+
|
5
|
+
translator = Mustermann::AST::Translator.new
|
6
|
+
translator.escape("foo")
|
7
|
+
|
8
|
+
h1 = ObjectSpace.each_object.inject(Hash.new 0) { |h, o| h[o.class] += 1; h }
|
9
|
+
|
10
|
+
100.times do
|
11
|
+
translator.escape("foo")
|
12
|
+
end
|
13
|
+
|
14
|
+
h2 = ObjectSpace.each_object.inject(Hash.new 0) { |h, o| h[o.class] += 1; h }
|
15
|
+
|
16
|
+
raise if (h2[URI::RFC2396_Parser] - h1[URI::RFC2396_Parser] != 0)
|
@@ -11,6 +11,9 @@ module Mustermann
|
|
11
11
|
# @abstract
|
12
12
|
# @!visibility private
|
13
13
|
class Translator
|
14
|
+
|
15
|
+
URI_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
|
16
|
+
|
14
17
|
# Encapsulates a single node translation
|
15
18
|
# @!visibility private
|
16
19
|
class NodeTranslator < DelegateClass(Node)
|
@@ -118,7 +121,7 @@ module Mustermann
|
|
118
121
|
|
119
122
|
# @return [String] escaped character
|
120
123
|
# @!visibility private
|
121
|
-
def escape(char, parser:
|
124
|
+
def escape(char, parser: URI_PARSER, escape: URI_PARSER.regexp[:UNSAFE], also_escape: nil)
|
122
125
|
escape = Regexp.union(also_escape, escape) if also_escape
|
123
126
|
char.to_s =~ escape ? parser.escape(char, Regexp.union(*escape)) : char
|
124
127
|
end
|
data/lib/mustermann/pattern.rb
CHANGED
data/lib/mustermann/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mustermann
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-09-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby2_keywords
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- bench/regexp.rb
|
38
38
|
- bench/simple_vs_sinatra.rb
|
39
39
|
- bench/template_vs_addressable.rb
|
40
|
+
- bench/uri_parser_object.rb
|
40
41
|
- lib/mustermann.rb
|
41
42
|
- lib/mustermann/ast/boundaries.rb
|
42
43
|
- lib/mustermann/ast/compiler.rb
|