protobuf 2.2.7-java → 2.3.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/protobuf/enum_value.rb +3 -18
- data/lib/protobuf/version.rb +1 -1
- data/spec/lib/protobuf/enum_value_spec.rb +0 -16
- metadata +2 -2
data/lib/protobuf/enum_value.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'delegate'
|
1
2
|
require 'protobuf/enum'
|
2
3
|
|
3
4
|
##
|
@@ -13,8 +14,7 @@ class Numeric
|
|
13
14
|
end
|
14
15
|
|
15
16
|
module Protobuf
|
16
|
-
class EnumValue
|
17
|
-
include Comparable
|
17
|
+
class EnumValue < SimpleDelegator
|
18
18
|
|
19
19
|
attr_reader :parent_class, :name
|
20
20
|
|
@@ -25,18 +25,7 @@ module Protobuf
|
|
25
25
|
@parent_class = parent_class
|
26
26
|
@name = name
|
27
27
|
@value = value
|
28
|
-
|
29
|
-
|
30
|
-
##
|
31
|
-
# Public Instance Methods
|
32
|
-
#
|
33
|
-
def <=>(compared_value)
|
34
|
-
case compared_value
|
35
|
-
when ::Protobuf::EnumValue then
|
36
|
-
value <=> compared_value.to_i
|
37
|
-
when Numeric then
|
38
|
-
value <=> compared_value.to_i
|
39
|
-
end
|
28
|
+
super(@value)
|
40
29
|
end
|
41
30
|
|
42
31
|
# Overriding the class so ActiveRecord/Arel visitor will visit the enum as a Fixnum
|
@@ -68,10 +57,6 @@ module Protobuf
|
|
68
57
|
end
|
69
58
|
|
70
59
|
def value
|
71
|
-
if ::Protobuf.print_deprecation_warnings?
|
72
|
-
$stderr.puts("[WARNING] Calling #value on an EnumValue is deprecated and no longer needed.")
|
73
|
-
end
|
74
|
-
|
75
60
|
@value
|
76
61
|
end
|
77
62
|
|
data/lib/protobuf/version.rb
CHANGED
@@ -2,15 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Protobuf::EnumValue do
|
4
4
|
|
5
|
-
def capture_stderr(&required_block)
|
6
|
-
real_stderr = $stderr
|
7
|
-
$stderr = StringIO.new
|
8
|
-
yield
|
9
|
-
$stderr.string
|
10
|
-
ensure
|
11
|
-
$stderr = real_stderr
|
12
|
-
end
|
13
|
-
|
14
5
|
subject { Test::EnumTestType::ONE }
|
15
6
|
its(:class) { should eq(Fixnum) }
|
16
7
|
its(:parent_class) { should eq(Test::EnumTestType) }
|
@@ -26,11 +17,4 @@ describe Protobuf::EnumValue do
|
|
26
17
|
array[::Test::EnumTestType::ONE].should eq(1)
|
27
18
|
end
|
28
19
|
|
29
|
-
it "prints a Warning to $stderr when #value is called" do
|
30
|
-
local_warning = capture_stderr do
|
31
|
-
::Test::EnumTestType::ONE.value
|
32
|
-
end
|
33
|
-
|
34
|
-
local_warning.should match(/deprecated/i)
|
35
|
-
end
|
36
20
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.
|
5
|
+
version: 2.3.0
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- BJ Neilsen
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2012-11-
|
14
|
+
date: 2012-11-15 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|