the_pb 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/Gemfile.lock +4 -4
- data/lib/pb.rb +10 -0
- data/lib/pb/version.rb +1 -1
- data/pb.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb6041f0983f5e3855d14f58ff1940cf2e7e4d6a10c1f750428be00a36f98838
|
4
|
+
data.tar.gz: 590b5e5f3b7e1bd066ef7ce3590d0560017831db53ea3573662d5c446e8a45b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac3d4f93ca96285c79804b3d5df669acc90e42590dfea9ef15074281258373c7c0d4efcbf5e75651648e4188c0b74993f975582d8b9813461eb39bcd684ee46d
|
7
|
+
data.tar.gz: 79519c5f2a45484f6b5f257f2e17d694327bd6a5991d9b6e65625e5e1798283e57d8623c6f7a6891f1a48d1ff0aaa06cc021c95d091fa3d54955630ba4f77f95
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
the_pb (0.0.
|
4
|
+
the_pb (0.0.2)
|
5
5
|
google-protobuf (~> 3.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
pry (0.12.2)
|
15
15
|
coderay (~> 1.1.0)
|
16
16
|
method_source (~> 0.9.0)
|
17
|
-
rake (
|
17
|
+
rake (13.0.1)
|
18
18
|
rspec (3.9.0)
|
19
19
|
rspec-core (~> 3.9.0)
|
20
20
|
rspec-expectations (~> 3.9.0)
|
@@ -35,9 +35,9 @@ PLATFORMS
|
|
35
35
|
DEPENDENCIES
|
36
36
|
bundler (~> 2.0)
|
37
37
|
pry
|
38
|
-
rake (~>
|
38
|
+
rake (~> 13.0)
|
39
39
|
rspec (~> 3.0)
|
40
40
|
the_pb!
|
41
41
|
|
42
42
|
BUNDLED WITH
|
43
|
-
2.
|
43
|
+
2.1.4
|
data/lib/pb.rb
CHANGED
@@ -25,6 +25,7 @@ module Pb
|
|
25
25
|
# @return [Google::Protobuf::Timestamp, nil]
|
26
26
|
def to_timestamp(t)
|
27
27
|
return nil if t.nil?
|
28
|
+
return t if t.is_a?(Google::Protobuf::Timestamp)
|
28
29
|
case t
|
29
30
|
when DateTime, Date
|
30
31
|
t = t.to_time
|
@@ -40,6 +41,7 @@ module Pb
|
|
40
41
|
# @return [Google::Protobuf::StringValue, nil]
|
41
42
|
def to_strval(str)
|
42
43
|
return nil if str.nil?
|
44
|
+
return str if str.is_a?(Google::Protobuf::StringValue)
|
43
45
|
Google::Protobuf::StringValue.new(value: str)
|
44
46
|
end
|
45
47
|
|
@@ -47,6 +49,7 @@ module Pb
|
|
47
49
|
# @return [Google::Protobuf::Int32Value, nil]
|
48
50
|
def to_int32val(num)
|
49
51
|
return nil if num.nil?
|
52
|
+
return num if num.is_a?(Google::Protobuf::Int32Value)
|
50
53
|
Google::Protobuf::Int32Value.new(value: num)
|
51
54
|
end
|
52
55
|
|
@@ -54,6 +57,7 @@ module Pb
|
|
54
57
|
# @return [Google::Protobuf::Int64Value, nil]
|
55
58
|
def to_int64val(num)
|
56
59
|
return nil if num.nil?
|
60
|
+
return num if num.is_a?(Google::Protobuf::Int64Value)
|
57
61
|
case num
|
58
62
|
when String
|
59
63
|
n = num.to_i
|
@@ -67,6 +71,7 @@ module Pb
|
|
67
71
|
# @return [Google::Protobuf::UInt32Value, nil]
|
68
72
|
def to_uint32val(num)
|
69
73
|
return nil if num.nil?
|
74
|
+
return num if num.is_a?(Google::Protobuf::UInt32Value)
|
70
75
|
Google::Protobuf::UInt32Value.new(value: num)
|
71
76
|
end
|
72
77
|
|
@@ -74,6 +79,7 @@ module Pb
|
|
74
79
|
# @return [Google::Protobuf::UInt64Value, nil]
|
75
80
|
def to_uint64val(num)
|
76
81
|
return nil if num.nil?
|
82
|
+
return num if num.is_a?(Google::Protobuf::UInt64Value)
|
77
83
|
case num
|
78
84
|
when String
|
79
85
|
n = num.to_i
|
@@ -87,6 +93,7 @@ module Pb
|
|
87
93
|
# @return [Google::Protobuf::FloatValue, nil]
|
88
94
|
def to_floatval(num)
|
89
95
|
return nil if num.nil?
|
96
|
+
return num if num.is_a?(Google::Protobuf::FloatValue)
|
90
97
|
Google::Protobuf::FloatValue.new(value: num)
|
91
98
|
end
|
92
99
|
|
@@ -94,6 +101,7 @@ module Pb
|
|
94
101
|
# @return [Google::Protobuf::DoubleValue, nil]
|
95
102
|
def to_doubleval(num)
|
96
103
|
return nil if num.nil?
|
104
|
+
return num if num.is_a?(Google::Protobuf::DoubleValue)
|
97
105
|
Google::Protobuf::DoubleValue.new(value: num)
|
98
106
|
end
|
99
107
|
|
@@ -101,6 +109,7 @@ module Pb
|
|
101
109
|
# @return [Google::Protobuf::BoolValue, nil]
|
102
110
|
def to_boolval(b)
|
103
111
|
return nil if b.nil?
|
112
|
+
return b if b.is_a?(Google::Protobuf::BoolValue)
|
104
113
|
Google::Protobuf::BoolValue.new(value: b)
|
105
114
|
end
|
106
115
|
|
@@ -108,6 +117,7 @@ module Pb
|
|
108
117
|
# @return [Google::Protobuf::BytesValue, nil]
|
109
118
|
def to_bytesval(bytes)
|
110
119
|
return nil if bytes.nil?
|
120
|
+
return bytes if bytes.is_a?(Google::Protobuf::BytesValue)
|
111
121
|
Google::Protobuf::BytesValue.new(value: bytes)
|
112
122
|
end
|
113
123
|
|
data/lib/pb/version.rb
CHANGED
data/pb.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 2.0"
|
29
|
-
spec.add_development_dependency "rake", "~>
|
29
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
31
|
spec.add_development_dependency "pry"
|
32
32
|
spec.add_runtime_dependency "google-protobuf", "~> 3.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_pb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nao Minami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.0.
|
126
|
+
rubygems_version: 3.0.3
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Utility for Google Protocol Buffers.
|