protobuf 3.5.1 → 3.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/.rubocop_todo.yml CHANGED
@@ -1,33 +1,35 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-12-23 08:21:59 -0800 using RuboCop version 0.28.0.
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-09-25 12:31:31 -0700 using RuboCop version 0.34.2.
3
4
  # The point is for the user to remove these configuration records
4
5
  # one by one as the offenses are removed from the code base.
5
6
  # Note that changes in the inspected code, or installation of new
6
7
  # versions of RuboCop, may require this file to be generated again.
7
8
 
8
- # Offense count: 29
9
+ # Offense count: 7
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
12
+ Lint/EndAlignment:
13
+ Enabled: false
14
+
15
+ # Offense count: 31
9
16
  Metrics/AbcSize:
10
17
  Max: 59
11
18
 
12
- # Offense count: 3
19
+ # Offense count: 1
13
20
  Metrics/BlockNesting:
14
21
  Max: 5
15
22
 
16
- # Offense count: 8
17
- # Configuration parameters: CountComments.
18
- Metrics/ClassLength:
19
- Max: 232
20
-
21
- # Offense count: 3
23
+ # Offense count: 6
22
24
  Metrics/CyclomaticComplexity:
23
25
  Max: 10
24
26
 
25
- # Offense count: 491
27
+ # Offense count: 493
26
28
  # Configuration parameters: AllowURI, URISchemes.
27
29
  Metrics/LineLength:
28
30
  Max: 196
29
31
 
30
- # Offense count: 43
32
+ # Offense count: 44
31
33
  # Configuration parameters: CountComments.
32
34
  Metrics/MethodLength:
33
35
  Max: 38
@@ -37,23 +39,41 @@ Metrics/MethodLength:
37
39
  Metrics/ParameterLists:
38
40
  Max: 6
39
41
 
40
- # Offense count: 3
42
+ # Offense count: 6
41
43
  Metrics/PerceivedComplexity:
42
44
  Max: 11
43
45
 
44
- # Offense count: 189
46
+ # Offense count: 1
47
+ # Cop supports --auto-correct.
48
+ Performance/StringReplacement:
49
+ Exclude:
50
+ - 'lib/protobuf/rpc/buffer.rb'
51
+
52
+ # Offense count: 127
53
+ # Configuration parameters: Exclude.
45
54
  Style/Documentation:
46
55
  Enabled: false
47
56
 
48
57
  # Offense count: 12
49
58
  Style/DoubleNegation:
50
- Enabled: false
59
+ Exclude:
60
+ - 'lib/protobuf.rb'
61
+ - 'lib/protobuf/cli.rb'
62
+ - 'lib/protobuf/rpc/connectors/zmq.rb'
63
+ - 'lib/protobuf/rpc/servers/zmq/broker.rb'
64
+ - 'lib/protobuf/rpc/servers/zmq/server.rb'
65
+ - 'lib/protobuf/rpc/servers/zmq/worker.rb'
66
+ - 'lib/protobuf/rpc/service_directory.rb'
51
67
 
52
68
  # Offense count: 2
69
+ # Cop supports --auto-correct.
70
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
53
71
  Style/EmptyElse:
54
- Enabled: false
72
+ Exclude:
73
+ - 'lib/protobuf/enum.rb'
74
+ - 'lib/protobuf/message/fields.rb'
55
75
 
56
- # Offense count: 73
76
+ # Offense count: 77
57
77
  # Cop supports --auto-correct.
58
78
  # Configuration parameters: EnforcedStyle, SupportedStyles.
59
79
  Style/EmptyLinesAroundBlockBody:
@@ -71,17 +91,53 @@ Style/EmptyLinesAroundClassBody:
71
91
  Style/EmptyLinesAroundModuleBody:
72
92
  Enabled: false
73
93
 
94
+ # Offense count: 2
95
+ Style/IndentationWidth:
96
+ Exclude:
97
+ - 'protobuf.gemspec'
98
+ - 'lib/protobuf/cli.rb'
99
+
100
+ # Offense count: 3
101
+ Style/ElseAlignment:
102
+ Exclude:
103
+ - 'protobuf.gemspec'
104
+ - 'lib/protobuf/cli.rb'
105
+
106
+ # Offense count: 8
107
+ # Cop supports --auto-correct.
108
+ # Configuration parameters: AllowForAlignment.
109
+ Style/ExtraSpacing:
110
+ Exclude:
111
+ - 'lib/protobuf/rpc/connectors/common.rb'
112
+ - 'lib/protobuf/rpc/connectors/socket.rb'
113
+ - 'lib/protobuf/rpc/connectors/zmq.rb'
114
+ - 'lib/protobuf/rpc/servers/socket/server.rb'
115
+ - 'spec/lib/protobuf/rpc/service_directory_spec.rb'
116
+
74
117
  # Offense count: 46
75
118
  # Cop supports --auto-correct.
76
119
  Style/NumericLiterals:
77
120
  MinDigits: 21
78
121
 
79
- # Offense count: 463
122
+ # Offense count: 473
80
123
  # Cop supports --auto-correct.
81
124
  # Configuration parameters: EnforcedStyle, SupportedStyles.
82
125
  Style/StringLiterals:
83
126
  Enabled: false
84
127
 
128
+ # Offense count: 7
129
+ # Cop supports --auto-correct.
130
+ # Configuration parameters: IgnoredMethods.
131
+ Style/SymbolProc:
132
+ Exclude:
133
+ - 'lib/protobuf/generators/printable.rb'
134
+ - 'lib/protobuf/rpc/servers/socket/server.rb'
135
+ - 'spec/encoding/all_types_spec.rb'
136
+ - 'spec/encoding/extreme_values_spec.rb'
137
+ - 'spec/functional/socket_server_spec.rb'
138
+ - 'spec/functional/zmq_server_spec.rb'
139
+ - 'spec/lib/protobuf/rpc/servers/socket_server_spec.rb'
140
+
85
141
  # Offense count: 4
86
142
  # Cop supports --auto-correct.
87
143
  # Configuration parameters: WordRegex.
data/lib/protobuf/enum.rb CHANGED
@@ -58,6 +58,15 @@ module Protobuf
58
58
  const_set(name, enum)
59
59
  end
60
60
 
61
+ # Internal: A mapping of enum number -> enums defined
62
+ # used for speeding up our internal enum methods.
63
+ def self.mapped_enums
64
+ @mapped_enums ||= enums.each_with_object({}) do |enum, hash|
65
+ list = hash[enum.to_i] ||= []
66
+ list << enum
67
+ end
68
+ end
69
+
61
70
  # Public: All defined enums.
62
71
  #
63
72
  class << self
@@ -83,9 +92,7 @@ module Protobuf
83
92
  # Returns an array with zero or more Enum objects or nil.
84
93
  #
85
94
  def self.enums_for_tag(tag)
86
- enums.select do |enum|
87
- enum.to_i == tag.to_i
88
- end
95
+ mapped_enums[tag.to_i] || []
89
96
  end
90
97
 
91
98
  # Public: Get the Enum associated with the given name.
@@ -120,7 +127,8 @@ module Protobuf
120
127
  # Enums, the first enum defined will be returned.
121
128
  #
122
129
  def self.enum_for_tag(tag)
123
- enums_for_tag(tag).first
130
+ value = mapped_enums[tag.to_i]
131
+ value ? value.first : nil
124
132
  end
125
133
 
126
134
  # Public: Get an Enum by a variety of type-checking mechanisms.
@@ -198,7 +206,7 @@ module Protobuf
198
206
  # Returns a boolean.
199
207
  #
200
208
  def self.valid_tag?(tag)
201
- tag.respond_to?(:to_i) && all_tags.include?(tag.to_i)
209
+ tag.respond_to?(:to_i) && mapped_enums.key?(tag.to_i)
202
210
  end
203
211
 
204
212
  # Public: [DEPRECATED] Return a hash of Enum objects keyed
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.5.1'
2
+ VERSION = '3.5.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-07-02 00:00:00.000000000 Z
15
+ date: 2015-09-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -445,7 +445,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
445
445
  version: '0'
446
446
  segments:
447
447
  - 0
448
- hash: 1619440131010607599
448
+ hash: -1916950250382935987
449
449
  required_rubygems_version: !ruby/object:Gem::Requirement
450
450
  none: false
451
451
  requirements:
@@ -454,7 +454,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
454
454
  version: '0'
455
455
  segments:
456
456
  - 0
457
- hash: 1619440131010607599
457
+ hash: -1916950250382935987
458
458
  requirements: []
459
459
  rubyforge_project:
460
460
  rubygems_version: 1.8.24