protobuf 2.4.6 → 2.4.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -125,16 +125,6 @@ module Protobuf
125
125
  !! @packed
126
126
  end
127
127
 
128
- # Upper limit for this field.
129
- def max
130
- self.class.max
131
- end
132
-
133
- # Lower limit for this field.
134
- def min
135
- self.class.min
136
- end
137
-
138
128
  def to_s
139
129
  "#{@rule} #{@type} #{@name} = #{@tag} #{@default ? "[default=#{@default.inspect}]" : ''}"
140
130
  end
@@ -5,9 +5,25 @@ module Protobuf
5
5
  class StringField < BytesField
6
6
  ENCODING = 'UTF-8'.freeze
7
7
 
8
- def decode(bytes)
9
- bytes.force_encoding(::Protobuf::Field::StringField::ENCODING)
10
- bytes
8
+ def define_setter
9
+ field = self
10
+ @message_class.class_eval do
11
+ define_method(field.setter_method_name) do |val|
12
+ begin
13
+ field.warn_if_deprecated
14
+
15
+ if val.nil? || val.empty?
16
+ @values.delete(field.name)
17
+ elsif field.acceptable?(val)
18
+ @values[field.name] = val.dup
19
+ else
20
+ raise TypeError, "unacceptable value #{val} for type #{field.type}"
21
+ end
22
+ rescue NoMethodError => ex
23
+ raise TypeError, "unacceptable value #{val} for type #{field.type} field #{field.name}"
24
+ end
25
+ end
26
+ end
11
27
  end
12
28
 
13
29
  def encode(value)
@@ -1,4 +1,4 @@
1
1
  module Protobuf
2
- VERSION = '2.4.6'
2
+ VERSION = '2.4.7'
3
3
  PROTOC_VERSION = '2.4.1'
4
4
  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.4.6
4
+ version: 2.4.7
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: 2012-11-17 00:00:00.000000000 Z
13
+ date: 2012-11-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -498,7 +498,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
498
498
  version: '0'
499
499
  segments:
500
500
  - 0
501
- hash: 2847695183920020007
501
+ hash: 1379767212789735468
502
502
  required_rubygems_version: !ruby/object:Gem::Requirement
503
503
  none: false
504
504
  requirements:
@@ -507,7 +507,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
507
507
  version: '0'
508
508
  segments:
509
509
  - 0
510
- hash: 2847695183920020007
510
+ hash: 1379767212789735468
511
511
  requirements: []
512
512
  rubyforge_project:
513
513
  rubygems_version: 1.8.24