protobuf 2.4.6 → 2.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/protobuf/field/base_field.rb +0 -10
- data/lib/protobuf/field/string_field.rb +19 -3
- data/lib/protobuf/version.rb +1 -1
- metadata +4 -4
@@ -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
|
9
|
-
|
10
|
-
|
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)
|
data/lib/protobuf/version.rb
CHANGED
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.
|
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-
|
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:
|
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:
|
510
|
+
hash: 1379767212789735468
|
511
511
|
requirements: []
|
512
512
|
rubyforge_project:
|
513
513
|
rubygems_version: 1.8.24
|