paquito 0.3.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +16 -1
- data/.rubocop.yml +1 -1
- data/Gemfile +3 -2
- data/Gemfile.lock +29 -25
- data/README.md +14 -13
- data/Rakefile +2 -1
- data/benchmark/msgpack-pooling.rb +19 -0
- data/dev.yml +1 -1
- data/lib/paquito/active_record_coder.rb +5 -4
- data/lib/paquito/allow_nil.rb +2 -0
- data/lib/paquito/codec_factory.rb +18 -8
- data/lib/paquito/safe_yaml.rb +3 -1
- data/lib/paquito/typed_struct.rb +1 -0
- data/lib/paquito/types.rb +38 -30
- data/lib/paquito/version.rb +1 -1
- data/paquito.gemspec +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7827d51263d503a0798dda51d14f0233f7a310e37f247b14a5ea13454403b3a5
|
4
|
+
data.tar.gz: 63381b29bd17cbc2473036ef0f6ca8eee60f099e7d2f70202a6922ba6721313a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75dba9ef5f38a56e765736b63549168e049d695615e6bc6bc545bb05deb7104b452094556cc3899d8fa0bf677ae7deef944f92f71c816af5f390a0e03c0f111b
|
7
|
+
data.tar.gz: 56d37636f06418d32263a803b84fb1bf15cd4fe07b6b7fd7bf28252e162aabfdedc8cfb9d2ac5e2c03231cd0b4b2bb7cd3b879f43ced04b0af753923cbca5bff
|
data/.github/workflows/ci.yml
CHANGED
@@ -3,12 +3,27 @@ name: CI
|
|
3
3
|
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
|
+
rubocop:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
steps:
|
11
|
+
- name: Checkout
|
12
|
+
uses: actions/checkout@v2
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: '2.6'
|
17
|
+
bundler-cache: true
|
18
|
+
- name: Run test
|
19
|
+
run: bundle exec rubocop
|
20
|
+
|
6
21
|
rubies:
|
7
22
|
runs-on: ubuntu-latest
|
8
23
|
strategy:
|
9
24
|
fail-fast: false
|
10
25
|
matrix:
|
11
|
-
ruby: [ ruby-head, '3.0', '2.7' ]
|
26
|
+
ruby: [ ruby-head, '3.0', '2.7', '2.6' ]
|
12
27
|
steps:
|
13
28
|
- name: Checkout
|
14
29
|
uses: actions/checkout@v2
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,55 +1,58 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
paquito (0.
|
5
|
-
msgpack
|
4
|
+
paquito (0.6.0)
|
5
|
+
msgpack (>= 1.5.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
activerecord (
|
13
|
-
activemodel (=
|
14
|
-
activesupport (=
|
15
|
-
activesupport (
|
10
|
+
activemodel (6.1.5)
|
11
|
+
activesupport (= 6.1.5)
|
12
|
+
activerecord (6.1.5)
|
13
|
+
activemodel (= 6.1.5)
|
14
|
+
activesupport (= 6.1.5)
|
15
|
+
activesupport (6.1.5)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 1.6, < 2)
|
18
18
|
minitest (>= 5.1)
|
19
19
|
tzinfo (~> 2.0)
|
20
|
+
zeitwerk (~> 2.3)
|
20
21
|
ast (2.4.2)
|
22
|
+
benchmark-ips (2.10.0)
|
21
23
|
byebug (11.1.3)
|
22
24
|
concurrent-ruby (1.1.9)
|
23
|
-
i18n (1.
|
25
|
+
i18n (1.10.0)
|
24
26
|
concurrent-ruby (~> 1.0)
|
25
|
-
minitest (5.
|
26
|
-
msgpack (1.
|
27
|
+
minitest (5.15.0)
|
28
|
+
msgpack (1.5.1)
|
27
29
|
parallel (1.21.0)
|
28
|
-
parser (3.
|
30
|
+
parser (3.1.1.0)
|
29
31
|
ast (~> 2.4.1)
|
30
|
-
rainbow (3.
|
32
|
+
rainbow (3.1.1)
|
31
33
|
rake (13.0.6)
|
32
|
-
regexp_parser (2.
|
34
|
+
regexp_parser (2.2.1)
|
33
35
|
rexml (3.2.5)
|
34
|
-
rubocop (1.
|
36
|
+
rubocop (1.25.1)
|
35
37
|
parallel (~> 1.10)
|
36
|
-
parser (>= 3.
|
38
|
+
parser (>= 3.1.0.0)
|
37
39
|
rainbow (>= 2.2.2, < 4.0)
|
38
40
|
regexp_parser (>= 1.8, < 3.0)
|
39
41
|
rexml
|
40
|
-
rubocop-ast (>= 1.
|
42
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
41
43
|
ruby-progressbar (~> 1.7)
|
42
44
|
unicode-display_width (>= 1.4.0, < 3.0)
|
43
|
-
rubocop-ast (1.
|
44
|
-
parser (>= 3.
|
45
|
-
rubocop-shopify (2.
|
46
|
-
rubocop (~> 1.
|
45
|
+
rubocop-ast (1.16.0)
|
46
|
+
parser (>= 3.1.1.0)
|
47
|
+
rubocop-shopify (2.5.0)
|
48
|
+
rubocop (~> 1.25)
|
47
49
|
ruby-progressbar (1.11.0)
|
48
|
-
sorbet-runtime (0.5.
|
50
|
+
sorbet-runtime (0.5.9742)
|
49
51
|
sqlite3 (1.4.2)
|
50
52
|
tzinfo (2.0.4)
|
51
53
|
concurrent-ruby (~> 1.0)
|
52
54
|
unicode-display_width (2.1.0)
|
55
|
+
zeitwerk (2.5.4)
|
53
56
|
|
54
57
|
PLATFORMS
|
55
58
|
ruby
|
@@ -57,8 +60,9 @@ PLATFORMS
|
|
57
60
|
x86_64-linux
|
58
61
|
|
59
62
|
DEPENDENCIES
|
60
|
-
activerecord
|
61
|
-
activesupport
|
63
|
+
activerecord
|
64
|
+
activesupport
|
65
|
+
benchmark-ips
|
62
66
|
byebug
|
63
67
|
minitest (~> 5.0)
|
64
68
|
paquito!
|
@@ -69,4 +73,4 @@ DEPENDENCIES
|
|
69
73
|
sqlite3
|
70
74
|
|
71
75
|
BUNDLED WITH
|
72
|
-
2.
|
76
|
+
2.3.11
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
### `chain`
|
24
24
|
|
25
|
-
`Paquito::CoderChain`
|
25
|
+
`Paquito::CoderChain` combines two or more serializers into one.
|
26
26
|
|
27
27
|
Example:
|
28
28
|
|
@@ -34,7 +34,7 @@ compressed_yaml_coder.load(payload) # => { foo: 42 }
|
|
34
34
|
|
35
35
|
### `ConditionalCompressor`
|
36
36
|
|
37
|
-
`Paquito::ConditionalCompressor`
|
37
|
+
`Paquito::ConditionalCompressor` compresses payloads if they are over a defined size.
|
38
38
|
|
39
39
|
Example:
|
40
40
|
```ruby
|
@@ -45,8 +45,8 @@ coder.dump("foo" * 500) # => "\x01<compressed-data....>"
|
|
45
45
|
|
46
46
|
### `SingleBytePrefixVersion`
|
47
47
|
|
48
|
-
`Paquito::SingleBytePrefixVersion` prepends a version prefix to the payloads, which
|
49
|
-
different serialization methods.
|
48
|
+
`Paquito::SingleBytePrefixVersion` prepends a version prefix to the payloads, which allows you to seamlessly transition
|
49
|
+
between different serialization methods.
|
50
50
|
|
51
51
|
The first argument is the current version used for newly generated payloads.
|
52
52
|
|
@@ -64,9 +64,9 @@ coder.load("\x00---\n:foo: 42") # => { foo: 42 }
|
|
64
64
|
|
65
65
|
### `CommentPrefixVersion`
|
66
66
|
|
67
|
-
Similar to the single byte prefix, but meant to be human readable and to allow for migrating
|
67
|
+
Similar to the single byte prefix, but meant to be human readable and to allow for migrating unversioned payloads.
|
68
68
|
|
69
|
-
|
69
|
+
Payloads without a version prefix are assumed to be version `0`.
|
70
70
|
|
71
71
|
The first argument is the current version used for newly generated payloads.
|
72
72
|
|
@@ -84,7 +84,7 @@ coder.dump([1]) # => "#☠1☢\n[1]"
|
|
84
84
|
|
85
85
|
### `allow_nil`
|
86
86
|
|
87
|
-
In some
|
87
|
+
In some situations where you'd rather not serialize `nil`, you can use the `Paquito.allow_nil` shorthand:
|
88
88
|
|
89
89
|
```ruby
|
90
90
|
coder = Paquito.allow_nil(Marshal)
|
@@ -95,7 +95,7 @@ coder.load(nil) # => nil
|
|
95
95
|
### `TranslateErrors`
|
96
96
|
|
97
97
|
If you do need to handle serialization or deserialization errors, for instance to fallback to acting like a cache miss,
|
98
|
-
`Paquito::TranslateErrors`
|
98
|
+
`Paquito::TranslateErrors` translates all underlying exceptions into `Paquito::Error` descendants.
|
99
99
|
|
100
100
|
Example:
|
101
101
|
|
@@ -117,7 +117,8 @@ coder.load(coder.dump(%i(foo bar).to_set)) # => #<Set: {:foo, :bar}>
|
|
117
117
|
|
118
118
|
### `TypedStruct`
|
119
119
|
|
120
|
-
`Paquito::TypedStruct` is a opt-in Sorbet runtime plugin that allows `T::Struct` classes to be serializable. You need
|
120
|
+
`Paquito::TypedStruct` is a opt-in Sorbet runtime plugin that allows `T::Struct` classes to be serializable. You need
|
121
|
+
to explicitly include the module in the `T::Struct` classes that you will be serializing.
|
121
122
|
|
122
123
|
Example
|
123
124
|
|
@@ -137,12 +138,12 @@ MyStruct.from_pack([26450, "foo", 1]) # => <MyStruct bar=1, foo="foo">
|
|
137
138
|
|
138
139
|
## Rails utilities
|
139
140
|
|
140
|
-
`paquito` doesn't
|
141
|
+
`paquito` doesn't depend on `rails` or any of its components, however it does provide some optional utilities.
|
141
142
|
|
142
143
|
### `CacheEntryCoder`
|
143
144
|
|
144
|
-
`Paquito::CacheEntryCoder` turns an `ActiveSupport::Cache::Entry` instance into a simple `Array` instance. This allows
|
145
|
-
implement custom coders for `ActiveSupport::Cache`.
|
145
|
+
`Paquito::CacheEntryCoder` turns an `ActiveSupport::Cache::Entry` instance into a simple `Array` instance. This allows
|
146
|
+
you to implement custom coders for `ActiveSupport::Cache`.
|
146
147
|
|
147
148
|
Example:
|
148
149
|
|
@@ -152,7 +153,7 @@ ActiveSupport::Cache::FileStore.new("tmp/cache", coder: Paquito.chain(Paquito::C
|
|
152
153
|
|
153
154
|
### `SerializedColumn`
|
154
155
|
|
155
|
-
`Paquito::SerializedColumn` allows to decorate any encoder to behave like Rails's builtin `YAMLColumn`
|
156
|
+
`Paquito::SerializedColumn` allows you to decorate any encoder to behave like Rails's builtin `YAMLColumn`
|
156
157
|
|
157
158
|
Example:
|
158
159
|
|
data/Rakefile
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
require "rake/testtask"
|
5
5
|
|
6
|
-
suites = [:vanilla, :activesupport
|
6
|
+
suites = [:vanilla, :activesupport]
|
7
|
+
suites << :activerecord if RUBY_VERSION >= "2.7"
|
7
8
|
namespace :test do
|
8
9
|
suites.each do |suite|
|
9
10
|
Rake::TestTask.new(suite) do |t|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "paquito"
|
6
|
+
require "benchmark/ips"
|
7
|
+
|
8
|
+
BASELINE = Paquito::CodecFactory.build([Symbol], pool: false)
|
9
|
+
POOLED = Paquito::CodecFactory.build([Symbol], pool: 1)
|
10
|
+
|
11
|
+
PAYLOAD = BASELINE.dump(:foo)
|
12
|
+
MARSHAL_PAYLOAD = Marshal.dump(:foo)
|
13
|
+
|
14
|
+
Benchmark.ips do |x|
|
15
|
+
x.report("marshal") { Marshal.load(MARSHAL_PAYLOAD) }
|
16
|
+
x.report("msgpack") { BASELINE.load(PAYLOAD) }
|
17
|
+
x.report("pooled") { POOLED.load(PAYLOAD) }
|
18
|
+
x.compare!(order: :baseline)
|
19
|
+
end
|
data/dev.yml
CHANGED
@@ -119,13 +119,14 @@ module Paquito
|
|
119
119
|
@ids = {}.compare_by_identity
|
120
120
|
end
|
121
121
|
|
122
|
-
def map(
|
123
|
-
@instances.map(
|
122
|
+
def map(&block)
|
123
|
+
@instances.map(&block)
|
124
124
|
end
|
125
125
|
|
126
|
-
def fetch(
|
127
|
-
@instances.fetch(
|
126
|
+
def fetch(*args, &block)
|
127
|
+
@instances.fetch(*args, &block)
|
128
128
|
end
|
129
|
+
ruby2_keywords :fetch if respond_to?(:ruby2_keywords, true)
|
129
130
|
|
130
131
|
def push(instance)
|
131
132
|
id = @ids[instance] = @instances.size
|
data/lib/paquito/allow_nil.rb
CHANGED
@@ -5,15 +5,21 @@ require "paquito/coder_chain"
|
|
5
5
|
|
6
6
|
module Paquito
|
7
7
|
class CodecFactory
|
8
|
-
def self.build(types, freeze: false, serializable_type: false)
|
9
|
-
factory =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
def self.build(types, freeze: false, serializable_type: false, pool: 1)
|
9
|
+
factory = if types.empty? && !serializable_type
|
10
|
+
MessagePack::DefaultFactory
|
11
|
+
else
|
12
|
+
MessagePack::Factory.new
|
13
|
+
end
|
14
|
+
|
15
15
|
Types.register(factory, types) unless types.empty?
|
16
16
|
Types.register_serializable_type(factory) if serializable_type
|
17
|
+
|
18
|
+
if pool && pool > 0 && factory.respond_to?(:pool)
|
19
|
+
factory = factory.freeze.pool(pool, freeze: freeze)
|
20
|
+
freeze = false
|
21
|
+
end
|
22
|
+
|
17
23
|
MessagePackCodec.new(factory, freeze: freeze)
|
18
24
|
end
|
19
25
|
|
@@ -32,7 +38,11 @@ module Paquito
|
|
32
38
|
end
|
33
39
|
|
34
40
|
def load(payload)
|
35
|
-
|
41
|
+
if @freeze
|
42
|
+
@factory.load(payload, freeze: @freeze)
|
43
|
+
else
|
44
|
+
@factory.load(payload)
|
45
|
+
end
|
36
46
|
rescue MessagePack::UnpackError => error
|
37
47
|
raise UnpackError, error.message
|
38
48
|
rescue IOError => error
|
data/lib/paquito/safe_yaml.rb
CHANGED
@@ -53,7 +53,7 @@ module Paquito
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def initialize(
|
56
|
+
def initialize(*)
|
57
57
|
super
|
58
58
|
@permitted_classes = Set.new(@options[:permitted_classes])
|
59
59
|
@dispatch_cache = DispatchCache.new(self, @dispatch_cache)
|
@@ -65,9 +65,11 @@ module Paquito
|
|
65
65
|
h[klass] = true
|
66
66
|
end.compare_by_identity
|
67
67
|
end
|
68
|
+
ruby2_keywords :initialize if respond_to?(:ruby2_keywords, true)
|
68
69
|
|
69
70
|
def dump_coder(target)
|
70
71
|
return unless permitted_class?(target.class)
|
72
|
+
|
71
73
|
super
|
72
74
|
end
|
73
75
|
|
data/lib/paquito/typed_struct.rb
CHANGED
data/lib/paquito/types.rb
CHANGED
@@ -37,10 +37,12 @@ module Paquito
|
|
37
37
|
def register(klass, packer: nil, unpacker:)
|
38
38
|
if packer
|
39
39
|
raise ArgumentError, "packer for #{klass} already defined" if packers.key?(klass)
|
40
|
+
|
40
41
|
packers[klass] = packer
|
41
42
|
end
|
42
43
|
|
43
44
|
raise ArgumentError, "unpacker for #{klass} already defined" if unpackers.key?(klass)
|
45
|
+
|
44
46
|
unpackers[klass] = unpacker
|
45
47
|
|
46
48
|
self
|
@@ -72,13 +74,13 @@ module Paquito
|
|
72
74
|
# New types can be added as long as they have unique #code.
|
73
75
|
TYPES = {
|
74
76
|
"Symbol" => {
|
75
|
-
code:
|
76
|
-
packer: Symbol.method_defined?(:name) ? :name : :to_s,
|
77
|
-
unpacker: :to_sym,
|
77
|
+
code: 0,
|
78
|
+
packer: Symbol.method_defined?(:name) ? :name.to_proc : :to_s.to_proc,
|
79
|
+
unpacker: :to_sym.to_proc,
|
78
80
|
optimized_symbols_parsing: true,
|
79
81
|
}.freeze,
|
80
82
|
"Time" => {
|
81
|
-
code:
|
83
|
+
code: 1,
|
82
84
|
packer: ->(value) do
|
83
85
|
rational = value.utc.to_r
|
84
86
|
[rational.numerator, rational.denominator].pack(TIME_FORMAT)
|
@@ -89,7 +91,7 @@ module Paquito
|
|
89
91
|
end,
|
90
92
|
}.freeze,
|
91
93
|
"DateTime" => {
|
92
|
-
code:
|
94
|
+
code: 2,
|
93
95
|
packer: ->(value) do
|
94
96
|
sec = value.sec + value.sec_fraction
|
95
97
|
offset = value.offset
|
@@ -129,7 +131,7 @@ module Paquito
|
|
129
131
|
end,
|
130
132
|
}.freeze,
|
131
133
|
"Date" => {
|
132
|
-
code:
|
134
|
+
code: 3,
|
133
135
|
packer: ->(value) do
|
134
136
|
[value.year, value.month, value.day].pack(DATE_FORMAT)
|
135
137
|
end,
|
@@ -139,28 +141,30 @@ module Paquito
|
|
139
141
|
end,
|
140
142
|
}.freeze,
|
141
143
|
"BigDecimal" => {
|
142
|
-
code:
|
144
|
+
code: 4,
|
143
145
|
packer: :_dump,
|
144
146
|
unpacker: BigDecimal.method(:_load),
|
145
147
|
}.freeze,
|
146
148
|
# Range => { code: 0x05 }, do not recycle that code
|
147
149
|
"ActiveRecord::Base" => {
|
148
|
-
code:
|
150
|
+
code: 6,
|
149
151
|
packer: ->(value) { ActiveRecordPacker.dump(value) },
|
150
152
|
unpacker: ->(value) { ActiveRecordPacker.load(value) },
|
151
153
|
}.freeze,
|
152
154
|
"ActiveSupport::HashWithIndifferentAccess" => {
|
153
|
-
code:
|
154
|
-
packer: ->(
|
155
|
+
code: 7,
|
156
|
+
packer: ->(value, packer) do
|
155
157
|
unless value.instance_of?(ActiveSupport::HashWithIndifferentAccess)
|
156
158
|
raise PackError.new("cannot pack HashWithIndifferentClass subclass", value)
|
157
159
|
end
|
158
|
-
|
160
|
+
|
161
|
+
packer.write(value.to_h)
|
159
162
|
end,
|
160
|
-
unpacker: ->(
|
163
|
+
unpacker: ->(unpacker) { HashWithIndifferentAccess.new(unpacker.read) },
|
164
|
+
recursive: true,
|
161
165
|
},
|
162
166
|
"ActiveSupport::TimeWithZone" => {
|
163
|
-
code:
|
167
|
+
code: 8,
|
164
168
|
packer: ->(value) do
|
165
169
|
[
|
166
170
|
value.utc.to_i,
|
@@ -176,12 +180,28 @@ module Paquito
|
|
176
180
|
end,
|
177
181
|
},
|
178
182
|
"Set" => {
|
179
|
-
code:
|
180
|
-
packer: ->(
|
181
|
-
unpacker: ->(
|
183
|
+
code: 9,
|
184
|
+
packer: ->(value, packer) { packer.write(value.to_a) },
|
185
|
+
unpacker: ->(unpacker) { unpacker.read.to_set },
|
186
|
+
recursive: true,
|
182
187
|
},
|
183
|
-
#
|
184
|
-
|
188
|
+
# Integer => { code: 10 }, reserved for oversized Integer
|
189
|
+
# Object => { code: 127 }, reserved for serializable Object type
|
190
|
+
}
|
191
|
+
begin
|
192
|
+
require "msgpack/bigint"
|
193
|
+
|
194
|
+
TYPES["Integer"] = {
|
195
|
+
code: 10,
|
196
|
+
packer: MessagePack::Bigint.method(:to_msgpack_ext),
|
197
|
+
unpacker: MessagePack::Bigint.method(:from_msgpack_ext),
|
198
|
+
oversized_integer_extension: true,
|
199
|
+
}
|
200
|
+
rescue LoadError
|
201
|
+
# expected on older msgpack
|
202
|
+
end
|
203
|
+
|
204
|
+
TYPES.freeze
|
185
205
|
|
186
206
|
class << self
|
187
207
|
def register(factory, types)
|
@@ -194,10 +214,6 @@ module Paquito
|
|
194
214
|
end
|
195
215
|
|
196
216
|
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
|
-
)
|
201
217
|
factory.register_type(
|
202
218
|
type_attributes.fetch(:code),
|
203
219
|
type,
|
@@ -233,14 +249,6 @@ module Paquito
|
|
233
249
|
def define_custom_type(klass, packer: nil, unpacker:)
|
234
250
|
CustomTypesRegistry.register(klass, packer: packer, unpacker: unpacker)
|
235
251
|
end
|
236
|
-
|
237
|
-
private
|
238
|
-
|
239
|
-
def curry_callback(callback, factory)
|
240
|
-
return callback.to_proc if callback.is_a?(Symbol)
|
241
|
-
return callback if callback.arity == 1
|
242
|
-
callback.curry.call(factory)
|
243
|
-
end
|
244
252
|
end
|
245
253
|
end
|
246
254
|
end
|
data/lib/paquito/version.rb
CHANGED
data/paquito.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "Framework for defining efficient and extendable serializers"
|
13
13
|
spec.homepage = "https://github.com/Shopify/paquito"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
16
|
|
17
17
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
18
|
|
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.add_dependency("msgpack")
|
31
|
+
spec.add_dependency("msgpack", ">= 1.5.1")
|
32
32
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.5.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.5.1
|
27
27
|
description: Framework for defining efficient and extendable serializers
|
28
28
|
email:
|
29
29
|
- jean.boussier@gmail.com
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- LICENSE.txt
|
40
40
|
- README.md
|
41
41
|
- Rakefile
|
42
|
+
- benchmark/msgpack-pooling.rb
|
42
43
|
- bin/console
|
43
44
|
- bin/setup
|
44
45
|
- dev.yml
|
@@ -77,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
78
|
requirements:
|
78
79
|
- - ">="
|
79
80
|
- !ruby/object:Gem::Version
|
80
|
-
version: 2.
|
81
|
+
version: 2.6.0
|
81
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
83
|
requirements:
|
83
84
|
- - ">="
|