protobuf 2.7.4 → 2.7.5

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.
@@ -34,6 +34,10 @@ module Protobuf
34
34
  field_definition = ::Protobuf::Field.build(self, rule, type, fname, tag, options)
35
35
  field_name_hash[fname] = tag
36
36
  field_array[tag] = field_definition
37
+
38
+ define_method("#{fname}!") do
39
+ @values[fname]
40
+ end
37
41
  end
38
42
 
39
43
  # Reserve field numbers for extensions. Don't use this method directly.
@@ -1,4 +1,4 @@
1
1
  module Protobuf
2
- VERSION = '2.7.4'
2
+ VERSION = '2.7.5'
3
3
  PROTOC_VERSION = '2.4.1'
4
4
  end
@@ -3,6 +3,22 @@ require 'spec_helper'
3
3
  describe Protobuf::Message do
4
4
 
5
5
  describe '#initialize' do
6
+ it "initializes the enum getter to 0" do
7
+ test_enum = Test::EnumTestMessage.new
8
+ test_enum.non_default_enum.should eq(0)
9
+ end
10
+
11
+ it "exposes the enum getter raw value through ! method" do
12
+ test_enum = Test::EnumTestMessage.new
13
+ test_enum.non_default_enum!.should be_nil
14
+ end
15
+
16
+ it "exposes the enum getter raw value through ! method (when set)" do
17
+ test_enum = Test::EnumTestMessage.new
18
+ test_enum.non_default_enum = 1
19
+ test_enum.non_default_enum!.should eq(1)
20
+ end
21
+
6
22
  it "does not try to set attributes which have nil values" do
7
23
  Test::EnumTestMessage.any_instance.should_not_receive("non_default_enum=")
8
24
  test_enum = Test::EnumTestMessage.new(:non_default_enum => nil)
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.7.4
4
+ version: 2.7.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-11 00:00:00.000000000 Z
13
+ date: 2013-03-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -499,7 +499,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
499
499
  version: '0'
500
500
  segments:
501
501
  - 0
502
- hash: 933543426026237728
502
+ hash: -673423541748096297
503
503
  required_rubygems_version: !ruby/object:Gem::Requirement
504
504
  none: false
505
505
  requirements:
@@ -508,7 +508,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
508
508
  version: '0'
509
509
  segments:
510
510
  - 0
511
- hash: 933543426026237728
511
+ hash: -673423541748096297
512
512
  requirements: []
513
513
  rubyforge_project:
514
514
  rubygems_version: 1.8.25