protobuf 2.2.5 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/protobuf/enum.rb CHANGED
@@ -18,7 +18,7 @@ module Protobuf
18
18
  def self.fetch(value)
19
19
  case value
20
20
  when ::Protobuf::EnumValue then
21
- value
21
+ value.value
22
22
  when Numeric then
23
23
  enum_by_value(value.to_i)
24
24
  when String, Symbol then
@@ -41,7 +41,11 @@ module Protobuf
41
41
  end
42
42
 
43
43
  def to_i
44
- @value.to_i
44
+ @value
45
+ end
46
+
47
+ def to_int
48
+ @value.to_int
45
49
  end
46
50
 
47
51
  def to_s(format = :value_string)
@@ -33,7 +33,7 @@ module Protobuf
33
33
  end
34
34
 
35
35
  def log_signature
36
- @_log_signature ||= "client-#{self.class}"
36
+ @_log_signature ||= "[client-#{self.class}]"
37
37
  end
38
38
 
39
39
  # Set a complete callback on the client to return the object (self).
@@ -58,7 +58,7 @@ module Protobuf
58
58
  end
59
59
 
60
60
  def log_signature
61
- @_log_signature ||= "client-#{self.class}"
61
+ @_log_signature ||= "[client-#{self.class}]"
62
62
  end
63
63
 
64
64
  def parse_response
@@ -1,4 +1,4 @@
1
1
  module Protobuf
2
- VERSION = '2.2.5'
2
+ VERSION = '2.2.6'
3
3
  PROTOC_VERSION = '2.4.1'
4
4
  end
@@ -12,4 +12,8 @@ describe Protobuf::EnumValue do
12
12
  its(:inspect) { should eq('#<Protobuf::EnumValue Test::EnumTestType::ONE=1>') }
13
13
  specify { subject.to_s(:name).should eq("ONE") }
14
14
 
15
+ it "can be used as the index to an array" do
16
+ array = [0, 1, 2, 3]
17
+ array[::Test::EnumTestType::ONE].should eq(1)
18
+ end
15
19
  end
data/spec/spec_helper.rb CHANGED
@@ -23,12 +23,14 @@ end
23
23
  c.mock_with :rspec
24
24
 
25
25
  c.before(:suite) do
26
- unless ENV['NO_COMPILE_TEST_PROTOS']
27
- $stdout.puts 'Compiling test protos (use NO_COMPILE_TEST_PROTOS=1 to skip)'
28
- proto_path = File.expand_path("../support/", __FILE__)
29
- cmd = %Q{ rprotoc --proto_path=#{proto_path} --ruby_out=#{proto_path} #{File.join(proto_path, '**', '*.proto')} }
30
- puts cmd
31
- %x{#{cmd}}
26
+ unless defined?(JRUBY_VERSION)
27
+ unless ENV['NO_COMPILE_TEST_PROTOS']
28
+ $stdout.puts 'Compiling test protos (use NO_COMPILE_TEST_PROTOS=1 to skip)'
29
+ proto_path = File.expand_path("../support/", __FILE__)
30
+ cmd = %Q{ rprotoc --proto_path=#{proto_path} --ruby_out=#{proto_path} #{File.join(proto_path, '**', '*.proto')} }
31
+ puts cmd
32
+ %x{#{cmd}}
33
+ end
32
34
  end
33
35
  end
34
36
  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: 2.2.5
4
+ version: 2.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -501,7 +501,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
501
501
  version: '0'
502
502
  segments:
503
503
  - 0
504
- hash: 2034933947553606240
504
+ hash: -4600146451913985150
505
505
  required_rubygems_version: !ruby/object:Gem::Requirement
506
506
  none: false
507
507
  requirements:
@@ -510,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
510
510
  version: '0'
511
511
  segments:
512
512
  - 0
513
- hash: 2034933947553606240
513
+ hash: -4600146451913985150
514
514
  requirements: []
515
515
  rubyforge_project:
516
516
  rubygems_version: 1.8.24