mustermann 3.0.2 → 3.0.4

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: f741e41af9f892bda29c749e01f9e9fda2cbadafdccf6a1655bdbe9153bd708c
4
- data.tar.gz: ea5b007782b635e98b8b7b5b0960899ef2bdd4a78e68aa006d5d8da50befc3ca
3
+ metadata.gz: ffbf76294166044123cd87324aed9709679a8ef4893219bcf75cbefd398d52b7
4
+ data.tar.gz: 4cbc5a0908b6f0839ad1875543b869da09e59ace62f4be875e259326f3f874f4
5
5
  SHA512:
6
- metadata.gz: d257e168b35207edf9271c973cc35eb2a9fa1d0cf49d41083cae0723da2e37bd1b40d1c29eb3a9ec22e34afde79382ec466cd6b0677e32201f61ee856df22890
7
- data.tar.gz: d9edaaf4286f574e5d84414a85260be41ad72d7fbd68a2e35daf5e8320ab6ec67bea4533dcd3a32fd079ab02755e342f7569321ce8ed054595d8419d186c77cb
6
+ metadata.gz: 88f278df75556096c65cf7148a7a543a2d4620b86568bb58c0bd649e6383caf6257a2417e2d9e6d260c5ac042c54eb91545120301a9d3262d9e9e134857d13f3
7
+ data.tar.gz: 8052170d96e904511af77ca90d966735b51338186ec9be0e61d10def3e2974a08fdfc62f6dbc9414ae92ffa35fd2102bf546bd0a98c67e53bc91abb1c0a0e1c9
@@ -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: URI::RFC2396_Parser.new, escape: URI::RFC2396_Parser.new.regexp[:UNSAFE], also_escape: nil)
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Mustermann
3
- VERSION ||= '3.0.2'
3
+ VERSION ||= '3.0.4'
4
4
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustermann
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  - Zachary Scott
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-08-09 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: ruby2_keywords
@@ -37,6 +36,7 @@ files:
37
36
  - bench/regexp.rb
38
37
  - bench/simple_vs_sinatra.rb
39
38
  - bench/template_vs_addressable.rb
39
+ - bench/uri_parser_object.rb
40
40
  - lib/mustermann.rb
41
41
  - lib/mustermann/ast/boundaries.rb
42
42
  - lib/mustermann/ast/compiler.rb
@@ -89,7 +89,6 @@ homepage: https://github.com/sinatra/mustermann
89
89
  licenses:
90
90
  - MIT
91
91
  metadata: {}
92
- post_install_message:
93
92
  rdoc_options: []
94
93
  require_paths:
95
94
  - lib
@@ -104,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
103
  - !ruby/object:Gem::Version
105
104
  version: '0'
106
105
  requirements: []
107
- rubygems_version: 3.5.11
108
- signing_key:
106
+ rubygems_version: 3.6.9
109
107
  specification_version: 4
110
108
  summary: Your personal string matching expert.
111
109
  test_files: []