the_pb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a62a56ec70269bcfdbb806a194dd525a5572cb90d0b9af8f819dc894b54ccad
4
- data.tar.gz: e3a5fcac9c8d7188fb7562d3394fe263c819c59b505f498280a757f2b5e18f00
3
+ metadata.gz: fb6041f0983f5e3855d14f58ff1940cf2e7e4d6a10c1f750428be00a36f98838
4
+ data.tar.gz: 590b5e5f3b7e1bd066ef7ce3590d0560017831db53ea3573662d5c446e8a45b9
5
5
  SHA512:
6
- metadata.gz: 97a247a174280ad09214ec4006c697b35dcaeeff053b48113286a5feeacad2c07a0bb71fb6841e01193289c1fface1e33ab91e4cd05bcd7ede9cae6d762348f4
7
- data.tar.gz: 4c3b755836a7d624dfddd6ef25c99d56b8db6b890cde27e5507113e26c5530cbf2280ea4e9feb95135dbe0ff8f438c41d6aeedc9ec29d6f33bb894622f42a186
6
+ metadata.gz: ac3d4f93ca96285c79804b3d5df669acc90e42590dfea9ef15074281258373c7c0d4efcbf5e75651648e4188c0b74993f975582d8b9813461eb39bcd684ee46d
7
+ data.tar.gz: 79519c5f2a45484f6b5f257f2e17d694327bd6a5991d9b6e65625e5e1798283e57d8623c6f7a6891f1a48d1ff0aaa06cc021c95d091fa3d54955630ba4f77f95
@@ -4,4 +4,7 @@ language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
6
  - 2.6.3
7
- before_install: gem install bundler -v 2.0.2
7
+ before_install:
8
+ - gem install bundler -v 2.0.2
9
+ script:
10
+ - bundle exec rspec
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- the_pb (0.0.1)
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 (10.5.0)
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 (~> 10.0)
38
+ rake (~> 13.0)
39
39
  rspec (~> 3.0)
40
40
  the_pb!
41
41
 
42
42
  BUNDLED WITH
43
- 2.0.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
 
@@ -1,3 +1,3 @@
1
1
  module Pb
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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", "~> 10.0"
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.1
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-05 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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.6
126
+ rubygems_version: 3.0.3
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Utility for Google Protocol Buffers.