msgpack 1.7.1-java → 1.7.3-java

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: 16503c594830bed29a4a293b3595ccc1d6733107fb0f9e11f47d109ae1c660f7
4
- data.tar.gz: e0177555865e263b8b1a3b381f9b47089c46fe41bc93660be311eb70ba0fe056
3
+ metadata.gz: 397e65710f4e1cd375c1e3a1abc9e01c57eb2cca52da640a23ce6734b49c014b
4
+ data.tar.gz: 3f6b6f1e4600cd8097a714d60bacdabc3f7b48cbc101915d125c1e9972c72a2e
5
5
  SHA512:
6
- metadata.gz: a03c2f8796a4b99630f748b08276d9e42b1dc663baa62dac750127bb5e4fd414ad4782a18af7ae778996a0a77ccaae0d37dc2e64a15ef14ccfa7c8095ce54d2b
7
- data.tar.gz: 1cc775b4d74a424fd6544ac2071db7dbaa567efec65b80f79de621fa3a8f96293d13bf78afa066d86fe7ed2cbefaa4f87934fe7ea52dffc75b298f4fad039b49
6
+ metadata.gz: c98616c651977a2c8be28148c6c60a67a0ff69f8e979d63d53db805e1b49b0156341354e5abca18f58660cfe721da7c453fb1db0107be4cf63a52346294974d3
7
+ data.tar.gz: cca90599d4cb297f077be84185398026f03bd2544c6ca10bad0e46f319aea793423f0e081ceecaf88d2e37c18dea20d17c5f82cd99619bc225f2f0e335d64110
@@ -2,11 +2,46 @@ module MessagePack
2
2
  class Factory
3
3
  # see ext for other methods
4
4
 
5
+ def register_type(type, klass, options = { packer: :to_msgpack_ext, unpacker: :from_msgpack_ext })
6
+ raise FrozenError, "can't modify frozen MessagePack::Factory" if frozen?
7
+
8
+ if options
9
+ options = options.dup
10
+ case packer = options[:packer]
11
+ when nil, Proc
12
+ # all good
13
+ when String, Symbol
14
+ options[:packer] = packer.to_sym.to_proc
15
+ when Method
16
+ options[:packer] = packer.to_proc
17
+ when packer.respond_to?(:call)
18
+ options[:packer] = packer.method(:call).to_proc
19
+ else
20
+ raise ::TypeError, "expected :packer argument to be a callable object, got: #{packer.inspect}"
21
+ end
22
+
23
+ case unpacker = options[:unpacker]
24
+ when nil, Proc
25
+ # all good
26
+ when String, Symbol
27
+ options[:unpacker] = klass.method(unpacker).to_proc
28
+ when Method
29
+ options[:unpacker] = unpacker.to_proc
30
+ when packer.respond_to?(:call)
31
+ options[:unpacker] = unpacker.method(:call).to_proc
32
+ else
33
+ raise ::TypeError, "expected :unpacker argument to be a callable object, got: #{unpacker.inspect}"
34
+ end
35
+ end
36
+
37
+ register_type_internal(type, klass, options)
38
+ end
39
+
5
40
  # [ {type: id, class: Class(or nil), packer: arg, unpacker: arg}, ... ]
6
41
  def registered_types(selector=:both)
7
42
  packer, unpacker = registered_types_internal
8
- # packer: Class -> [tid, proc, arg]
9
- # unpacker: tid -> [klass, proc, arg]
43
+ # packer: Class -> [tid, proc, _flags]
44
+ # unpacker: tid -> [klass, proc, _flags]
10
45
 
11
46
  list = []
12
47
 
@@ -14,27 +49,31 @@ module MessagePack
14
49
  when :both
15
50
  packer.each_pair do |klass, ary|
16
51
  type = ary[0]
17
- packer_arg = ary[2]
18
- unpacker_arg = nil
19
- if unpacker.has_key?(type) && unpacker[type][0] == klass
20
- unpacker_arg = unpacker.delete(type)[2]
52
+ packer_proc = ary[1]
53
+ unpacker_proc = nil
54
+ if unpacker.has_key?(type)
55
+ unpacker_proc = unpacker.delete(type)[1]
21
56
  end
22
- list << {type: type, class: klass, packer: packer_arg, unpacker: unpacker_arg}
57
+ list << {type: type, class: klass, packer: packer_proc, unpacker: unpacker_proc}
23
58
  end
24
59
 
25
60
  # unpacker definition only
26
61
  unpacker.each_pair do |type, ary|
27
- list << {type: type, class: ary[0], packer: nil, unpacker: ary[2]}
62
+ list << {type: type, class: ary[0], packer: nil, unpacker: ary[1]}
28
63
  end
29
64
 
30
65
  when :packer
31
66
  packer.each_pair do |klass, ary|
32
- list << {type: ary[0], class: klass, packer: ary[2]}
67
+ if ary[1]
68
+ list << {type: ary[0], class: klass, packer: ary[1]}
69
+ end
33
70
  end
34
71
 
35
72
  when :unpacker
36
73
  unpacker.each_pair do |type, ary|
37
- list << {type: type, class: ary[0], unpacker: ary[2]}
74
+ if ary[1]
75
+ list << {type: type, class: ary[0], unpacker: ary[1]}
76
+ end
38
77
  end
39
78
 
40
79
  else
Binary file
@@ -6,11 +6,16 @@ module MessagePack
6
6
  undef_method :dup
7
7
  undef_method :clone
8
8
 
9
+ def register_type(type, klass, method_name = nil, &block)
10
+ raise ArgumentError, "expected Module/Class got: #{klass.inspect}" unless klass.is_a?(Module)
11
+ register_type_internal(type, klass, block || method_name.to_proc)
12
+ end
13
+
9
14
  def registered_types
10
15
  list = []
11
16
 
12
17
  registered_types_internal.each_pair do |klass, ary|
13
- list << {type: ary[0], class: klass, packer: ary[2]}
18
+ list << {type: ary[0], class: klass, packer: ary[1]}
14
19
  end
15
20
 
16
21
  list.sort{|a, b| a[:type] <=> b[:type] }
@@ -6,11 +6,20 @@ module MessagePack
6
6
  undef_method :dup
7
7
  undef_method :clone
8
8
 
9
+ def register_type(type, klass = nil, method_name = nil, &block)
10
+ if klass && method_name
11
+ block = klass.method(method_name).to_proc
12
+ elsif !block_given?
13
+ raise ArgumentError, "register_type takes either 3 arguments or a block"
14
+ end
15
+ register_type_internal(type, klass, block)
16
+ end
17
+
9
18
  def registered_types
10
19
  list = []
11
20
 
12
21
  registered_types_internal.each_pair do |type, ary|
13
- list << {type: type, class: ary[0], unpacker: ary[2]}
22
+ list << {type: type, class: ary[0], unpacker: ary[1]}
14
23
  end
15
24
 
16
25
  list.sort{|a, b| a[:type] <=> b[:type] }
@@ -1,5 +1,5 @@
1
1
  module MessagePack
2
- VERSION = "1.7.1"
2
+ VERSION = "1.7.3"
3
3
  # Note for maintainers:
4
4
  # Don't miss building/releasing the JRuby version (rake buld:java)
5
5
  # See "How to build -java rubygems" in README for more details.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.3
5
5
  platform: java
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -10,115 +10,115 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-05-19 00:00:00.000000000 Z
13
+ date: 2024-10-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
+ name: bundler
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
19
  - - ">="
19
20
  - !ruby/object:Gem::Version
20
21
  version: '0'
21
- name: bundler
22
- prerelease: false
23
22
  type: :development
23
+ prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
+ name: rake
30
31
  requirement: !ruby/object:Gem::Requirement
31
32
  requirements:
32
33
  - - ">="
33
34
  - !ruby/object:Gem::Version
34
35
  version: '0'
35
- name: rake
36
- prerelease: false
37
36
  type: :development
37
+ prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
+ name: rake-compiler
44
45
  requirement: !ruby/object:Gem::Requirement
45
46
  requirements:
46
47
  - - ">="
47
48
  - !ruby/object:Gem::Version
48
49
  version: 1.1.9
49
- name: rake-compiler
50
- prerelease: false
51
50
  type: :development
51
+ prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: 1.1.9
57
57
  - !ruby/object:Gem::Dependency
58
+ name: rspec
58
59
  requirement: !ruby/object:Gem::Requirement
59
60
  requirements:
60
61
  - - "~>"
61
62
  - !ruby/object:Gem::Version
62
63
  version: '3.3'
63
- name: rspec
64
- prerelease: false
65
64
  type: :development
65
+ prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '3.3'
71
71
  - !ruby/object:Gem::Dependency
72
+ name: ruby_memcheck
72
73
  requirement: !ruby/object:Gem::Requirement
73
74
  requirements:
74
75
  - - ">="
75
76
  - !ruby/object:Gem::Version
76
77
  version: '0'
77
- name: ruby_memcheck
78
- prerelease: false
79
78
  type: :development
79
+ prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
+ name: yard
86
87
  requirement: !ruby/object:Gem::Requirement
87
88
  requirements:
88
89
  - - ">="
89
90
  - !ruby/object:Gem::Version
90
91
  version: '0'
91
- name: yard
92
- prerelease: false
93
92
  type: :development
93
+ prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
+ name: json
100
101
  requirement: !ruby/object:Gem::Requirement
101
102
  requirements:
102
103
  - - ">="
103
104
  - !ruby/object:Gem::Version
104
105
  version: '0'
105
- name: json
106
- prerelease: false
107
106
  type: :development
107
+ prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  - !ruby/object:Gem::Dependency
114
+ name: benchmark-ips
114
115
  requirement: !ruby/object:Gem::Requirement
115
116
  requirements:
116
117
  - - "~>"
117
118
  - !ruby/object:Gem::Version
118
119
  version: 2.10.0
119
- name: benchmark-ips
120
- prerelease: false
121
120
  type: :development
121
+ prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - "~>"
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubygems_version: 3.3.25
170
+ rubygems_version: 3.3.26
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: MessagePack, a binary-based efficient data interchange format.