paquito 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -4
- data/Gemfile.lock +12 -18
- data/lib/paquito/safe_yaml.rb +19 -14
- data/lib/paquito/types.rb +6 -3
- data/lib/paquito/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d00c743e791d4a17131842b2f515d58cff0e62190c8509666aff3d0d34e2d005
|
4
|
+
data.tar.gz: b6760e6c8ceefa78e77f6b7c1a5668d40930c0d80fb8f841ea0a3deda82a77dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189792644f661fd6a5455921928ff94f911d972c971590ff6754bee2f0e27c3386199d0444286e279d6b658d755c3ad0e9deff2e6338620c5a1b81efe542365a
|
7
|
+
data.tar.gz: c4f9cb2d28a8598627497bf3e7f8c1de1a29e2fa0a37e54e06310af438fdd5f34b6c77c533a90b121559d5e77353b5fe316a8099b4d1f8b588873363edb43c3a
|
data/Gemfile
CHANGED
@@ -5,11 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
# Specify your gem's dependencies in paquito.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem "msgpack", github: "msgpack/msgpack-ruby" # Waiting for release of https://github.com/msgpack/msgpack-ruby/pull/220
|
9
|
-
|
10
8
|
gem "rake", "~> 13.0"
|
11
|
-
gem "activesupport", ">= 7.0.0
|
12
|
-
gem "activerecord", ">= 7.0.0
|
9
|
+
gem "activesupport", ">= 7.0.0"
|
10
|
+
gem "activerecord", ">= 7.0.0"
|
13
11
|
gem "sqlite3"
|
14
12
|
|
15
13
|
gem "minitest", "~> 5.0"
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,18 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/msgpack/msgpack-ruby.git
|
3
|
-
revision: ea20842ea732f4d625fd30c7b8f67655d73652f2
|
4
|
-
specs:
|
5
|
-
msgpack (1.4.2)
|
6
|
-
|
7
1
|
PATH
|
8
2
|
remote: .
|
9
3
|
specs:
|
10
|
-
paquito (0.3.
|
4
|
+
paquito (0.3.1)
|
11
5
|
msgpack
|
12
6
|
|
13
7
|
GEM
|
14
8
|
remote: https://rubygems.org/
|
15
9
|
specs:
|
16
|
-
activemodel (7.0.
|
17
|
-
activesupport (= 7.0.
|
18
|
-
activerecord (7.0.
|
19
|
-
activemodel (= 7.0.
|
20
|
-
activesupport (= 7.0.
|
21
|
-
activesupport (7.0.
|
10
|
+
activemodel (7.0.1)
|
11
|
+
activesupport (= 7.0.1)
|
12
|
+
activerecord (7.0.1)
|
13
|
+
activemodel (= 7.0.1)
|
14
|
+
activesupport (= 7.0.1)
|
15
|
+
activesupport (7.0.1)
|
22
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
23
17
|
i18n (>= 1.6, < 2)
|
24
18
|
minitest (>= 5.1)
|
@@ -26,9 +20,10 @@ GEM
|
|
26
20
|
ast (2.4.2)
|
27
21
|
byebug (11.1.3)
|
28
22
|
concurrent-ruby (1.1.9)
|
29
|
-
i18n (1.
|
23
|
+
i18n (1.9.1)
|
30
24
|
concurrent-ruby (~> 1.0)
|
31
25
|
minitest (5.14.4)
|
26
|
+
msgpack (1.4.4)
|
32
27
|
parallel (1.21.0)
|
33
28
|
parser (3.0.2.0)
|
34
29
|
ast (~> 2.4.1)
|
@@ -62,11 +57,10 @@ PLATFORMS
|
|
62
57
|
x86_64-linux
|
63
58
|
|
64
59
|
DEPENDENCIES
|
65
|
-
activerecord (>= 7.0.0
|
66
|
-
activesupport (>= 7.0.0
|
60
|
+
activerecord (>= 7.0.0)
|
61
|
+
activesupport (>= 7.0.0)
|
67
62
|
byebug
|
68
63
|
minitest (~> 5.0)
|
69
|
-
msgpack!
|
70
64
|
paquito!
|
71
65
|
rake (~> 13.0)
|
72
66
|
rubocop
|
@@ -75,4 +69,4 @@ DEPENDENCIES
|
|
75
69
|
sqlite3
|
76
70
|
|
77
71
|
BUNDLED WITH
|
78
|
-
2.2.
|
72
|
+
2.2.33
|
data/lib/paquito/safe_yaml.rb
CHANGED
@@ -43,31 +43,36 @@ module Paquito
|
|
43
43
|
|
44
44
|
class RestrictedYAMLTree < Psych::Visitors::YAMLTree
|
45
45
|
class DispatchCache
|
46
|
-
def initialize(visitor, cache
|
46
|
+
def initialize(visitor, cache)
|
47
47
|
@visitor = visitor
|
48
48
|
@cache = cache
|
49
|
-
@permitted_classes = permitted_classes
|
50
|
-
|
51
|
-
@permitted_cache = Hash.new do |h, klass|
|
52
|
-
unless @permitted_classes.include?(klass.name)
|
53
|
-
raise UnsupportedType, "Tried to dump unspecified class: #{klass.name.inspect}"
|
54
|
-
end
|
55
|
-
|
56
|
-
h[klass] = true
|
57
|
-
end.compare_by_identity
|
58
49
|
end
|
59
50
|
|
60
51
|
def [](klass)
|
61
|
-
if @
|
62
|
-
@cache[klass]
|
63
|
-
end
|
52
|
+
@cache[klass] if @visitor.permitted_class?(klass)
|
64
53
|
end
|
65
54
|
end
|
66
55
|
|
67
56
|
def initialize(...)
|
68
57
|
super
|
69
58
|
@permitted_classes = Set.new(@options[:permitted_classes])
|
70
|
-
@dispatch_cache = DispatchCache.new(self, @dispatch_cache
|
59
|
+
@dispatch_cache = DispatchCache.new(self, @dispatch_cache)
|
60
|
+
@permitted_cache = Hash.new do |h, klass|
|
61
|
+
unless @permitted_classes.include?(klass.name)
|
62
|
+
raise UnsupportedType, "Tried to dump unspecified class: #{klass.name.inspect}"
|
63
|
+
end
|
64
|
+
|
65
|
+
h[klass] = true
|
66
|
+
end.compare_by_identity
|
67
|
+
end
|
68
|
+
|
69
|
+
def dump_coder(target)
|
70
|
+
return unless permitted_class?(target.class)
|
71
|
+
super
|
72
|
+
end
|
73
|
+
|
74
|
+
def permitted_class?(klass)
|
75
|
+
@permitted_cache[klass]
|
71
76
|
end
|
72
77
|
end
|
73
78
|
end
|
data/lib/paquito/types.rb
CHANGED
@@ -73,7 +73,7 @@ module Paquito
|
|
73
73
|
TYPES = {
|
74
74
|
"Symbol" => {
|
75
75
|
code: 0x00,
|
76
|
-
packer: :to_s,
|
76
|
+
packer: Symbol.method_defined?(:name) ? :name : :to_s,
|
77
77
|
unpacker: :to_sym,
|
78
78
|
optimized_symbols_parsing: true,
|
79
79
|
}.freeze,
|
@@ -194,11 +194,14 @@ module Paquito
|
|
194
194
|
end
|
195
195
|
|
196
196
|
type_attributes = TYPES.fetch(name)
|
197
|
+
type_attributes = type_attributes.merge(
|
198
|
+
packer: curry_callback(type_attributes.fetch(:packer), factory),
|
199
|
+
unpacker: curry_callback(type_attributes.fetch(:unpacker), factory),
|
200
|
+
)
|
197
201
|
factory.register_type(
|
198
202
|
type_attributes.fetch(:code),
|
199
203
|
type,
|
200
|
-
|
201
|
-
unpacker: curry_callback(type_attributes.fetch(:unpacker), factory),
|
204
|
+
type_attributes
|
202
205
|
)
|
203
206
|
end
|
204
207
|
end
|
data/lib/paquito/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paquito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|