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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8270d4e3422ef944047a1a1832819ad3af49b90e4e2886423fcb4631a31586cf
4
- data.tar.gz: 1cb40c98fbfc61c79fa677569925e212643b3bc878d6ac053fa711a2929ad325
3
+ metadata.gz: d00c743e791d4a17131842b2f515d58cff0e62190c8509666aff3d0d34e2d005
4
+ data.tar.gz: b6760e6c8ceefa78e77f6b7c1a5668d40930c0d80fb8f841ea0a3deda82a77dd
5
5
  SHA512:
6
- metadata.gz: '0218b3e4e731b81e21c2f16df0eaa1f86c5267b815b9059de8922e233ceae9a7f4646bce089b215c38347e950fe20636753fd57aa5a9b61ef4617126fd4e96b8'
7
- data.tar.gz: 22b6023ea6c0edf6d5c23de9b36c908f5b323b449c14ecdab0562d59b131e5ed54341d19e6404cf22d351384531bf3943eba60c958aed9566fdc589b900b4ad4
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.alpha2"
12
- gem "activerecord", ">= 7.0.0.alpha2"
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.0)
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.0.alpha2)
17
- activesupport (= 7.0.0.alpha2)
18
- activerecord (7.0.0.alpha2)
19
- activemodel (= 7.0.0.alpha2)
20
- activesupport (= 7.0.0.alpha2)
21
- activesupport (7.0.0.alpha2)
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.8.10)
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.alpha2)
66
- activesupport (>= 7.0.0.alpha2)
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.22
72
+ 2.2.33
@@ -43,31 +43,36 @@ module Paquito
43
43
 
44
44
  class RestrictedYAMLTree < Psych::Visitors::YAMLTree
45
45
  class DispatchCache
46
- def initialize(visitor, cache, permitted_classes)
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 @permitted_cache[klass]
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, @permitted_classes)
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
- packer: curry_callback(type_attributes.fetch(:packer), factory),
201
- unpacker: curry_callback(type_attributes.fetch(:unpacker), factory),
204
+ type_attributes
202
205
  )
203
206
  end
204
207
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paquito
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
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.0
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: 2021-11-10 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack