protobuf 2.7.6-java → 2.7.7-java

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.rb CHANGED
@@ -2,7 +2,16 @@ require 'logger'
2
2
  require 'socket'
3
3
  require 'pp'
4
4
  require 'stringio'
5
- require 'active_support/all'
5
+ require 'active_support/core_ext/object/blank'
6
+ require 'active_support/core_ext/object/try'
7
+ require 'active_support/inflector'
8
+ require 'active_support/json'
9
+
10
+ begin # master
11
+ require 'active_support/core_ext/object/deep_dup'
12
+ rescue LoadError # 3.2.x
13
+ require 'active_support/core_ext/hash/deep_dup'
14
+ end
6
15
 
7
16
  module Protobuf
8
17
 
@@ -78,7 +78,8 @@ module Protobuf
78
78
 
79
79
  # Find a field object by +name+.
80
80
  def self.get_field_by_name(name)
81
- tag = field_name_to_tag[name.to_sym]
81
+ name = name.to_sym if name.respond_to?(:to_sym)
82
+ tag = field_name_to_tag[name]
82
83
  fields[tag] unless tag.nil?
83
84
  end
84
85
 
@@ -87,7 +88,6 @@ module Protobuf
87
88
  fields[tag]
88
89
  rescue TypeError => e
89
90
  tag = tag.nil? ? 'nil' : tag.to_s
90
- raise
91
91
  raise FieldNotDefinedError.new("Tag '#{tag}' does not reference a message field for '#{self.name}'")
92
92
  end
93
93
 
@@ -1,4 +1,4 @@
1
1
  module Protobuf
2
- VERSION = '2.7.6'
2
+ VERSION = '2.7.7'
3
3
  PROTOC_VERSION = '2.4.1'
4
4
  end
@@ -8,12 +8,12 @@ describe Protobuf::Message do
8
8
  test_enum.non_default_enum.should eq(0)
9
9
  end
10
10
 
11
- it "exposes the enum getter raw value through ! method" do
11
+ it "exposes the enum getter raw value through ! method" do
12
12
  test_enum = Test::EnumTestMessage.new
13
13
  test_enum.non_default_enum!.should be_nil
14
14
  end
15
15
 
16
- it "exposes the enum getter raw value through ! method (when set)" do
16
+ it "exposes the enum getter raw value through ! method (when set)" do
17
17
  test_enum = Test::EnumTestMessage.new
18
18
  test_enum.non_default_enum = 1
19
19
  test_enum.non_default_enum!.should eq(1)
@@ -227,21 +227,15 @@ describe Protobuf::Message do
227
227
 
228
228
  context 'when name is not a valid field' do
229
229
  specify do
230
- expect {
231
- subject.get_field_by_name(1)
232
- }.to raise_error(::Protobuf::FieldNotDefinedError, /.*1.*#{subject.class.name}/)
230
+ subject.get_field_by_name(1).should be_nil
233
231
  end
234
232
 
235
233
  specify do
236
- expect {
237
- subject.get_field_by_name(:nothere)
238
- }.to raise_error(::Protobuf::FieldNotDefinedError, /.*nothere.*#{subject.class.name}/)
234
+ subject.get_field_by_name(:nothere).should be_nil
239
235
  end
240
236
 
241
237
  specify do
242
- expect {
243
- subject.get_field_by_name(nil)
244
- }.to raise_error(::Protobuf::FieldNotDefinedError, /.*nil.*#{subject.class.name}/)
238
+ subject.get_field_by_name(nil).should be_nil
245
239
  end
246
240
  end
247
241
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.7.6
5
+ version: 2.7.7
6
6
  platform: java
7
7
  authors:
8
8
  - BJ Neilsen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-17 00:00:00.000000000Z
13
+ date: 2013-03-18 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport