protobug_well_known_protos 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b08ae3c504d305248dda53c7720cc562905839fd9fcbe44e1458f16ad88a429
4
- data.tar.gz: 2659920109668e8d541e1d46cbaff2d46dfa7215e74ce0ddc086421aebc92168
3
+ metadata.gz: 1c2e12698a08e502fcadd6c11533c55993e75fd2a2f859727a0656545cc94718
4
+ data.tar.gz: bd6946a45157f87f80dc27f099ae1fe5ff95feaf0301c1d17a0f96be87199f3c
5
5
  SHA512:
6
- metadata.gz: a2389d6b25c1fe80f8e75d6079cd78080e8d1e5f6f87d6b5e19b4d29b007a5c84ec24d38b2590346f180848a4571b31901d9c832a5ce8aec256088833c2d58bb
7
- data.tar.gz: d0f5141be655c8afd89473a413a5835579a70509d66c62872e1ae6dd3db741d1e7a550b1b197a21fd461227df67d8194d4084f1dc9e8bd7e472ad78c92a6bae9
6
+ metadata.gz: 8cb42f9f55d0e90a87db11aa629453fe6bbf865f6be2a2315acdb90c7ffe1ee094b87b5ed9208c8b0886b0c190a83163e1f42fc519c4e931ff805ba235e0d992
7
+ data.tar.gz: 204e98f50883f8fc8fb60c386a3a3679cd9f73785521f175f49588174e221ad25f623c023169fb0ce3b17bf69751fbf585737f83992e094eedc177bc9913f6ae
@@ -31,8 +31,8 @@ Google::Protobuf::Duration.class_eval do
31
31
 
32
32
  self.class.validate_json_range(Protobug::EncodeError, seconds, nanos)
33
33
 
34
- sign = seconds.negative? ? "-" : ""
35
- sign = "-" if seconds.zero? && nanos.negative?
34
+ sign = seconds < 0 ? "-" : ""
35
+ sign = "-" if seconds == 0 && nanos < 0
36
36
  seconds = seconds.abs
37
37
  nanos = nanos.abs
38
38
  if nanos.nonzero?
@@ -43,8 +43,9 @@ Google::Protobuf::Duration.class_eval do
43
43
  end
44
44
 
45
45
  def self.validate_json_range(err, seconds, nanos)
46
- if seconds != 0 && nanos != 0 && (seconds.negative? ^ nanos.negative?)
47
- raise err, "seconds and nanos must have the same sign"
46
+ if seconds != 0 && nanos != 0 && ((seconds < 0) ^ (nanos < 0))
47
+ raise err,
48
+ "seconds and nanos must have the same sign"
48
49
  end
49
50
 
50
51
  raise err, "seconds out of range for json duration" if seconds < -315_576_000_000 || seconds > +315_576_000_000
@@ -186,7 +186,7 @@ Google::Protobuf::NullValue.class_eval do
186
186
  end
187
187
 
188
188
  def as_json(print_unknown_fields: false)
189
- return if value.zero?
189
+ return if value == 0
190
190
 
191
191
  super
192
192
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "date"
4
+
3
5
  Google::Protobuf::Timestamp.class_eval do
4
6
  def to_time
5
7
  Time.at(seconds, nanos, :nanosecond, in: 0)
@@ -52,7 +54,7 @@ Google::Protobuf::Timestamp.class_eval do
52
54
 
53
55
  nanosecs = time.nsec
54
56
 
55
- if nanosecs.positive?
57
+ if nanosecs > 0
56
58
  nanosecs = nanosecs.to_s.rjust(9, "0")
57
59
  nil while nanosecs.delete_suffix!("000")
58
60
  digits = nanosecs.size
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobug_well_known_protos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Giddins
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-25 00:00:00.000000000 Z
11
+ date: 2026-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protobug
@@ -16,15 +16,15 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.0
19
+ version: 0.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.0
27
- description:
26
+ version: 0.2.0
27
+ description:
28
28
  email:
29
29
  - segiddins@segiddins.me
30
30
  executables: []
@@ -49,12 +49,12 @@ files:
49
49
  - lib/google/protobuf/wrappers_pb.rb
50
50
  - lib/google/protobuf/wrappers_well_known.rb
51
51
  - lib/protobug_well_known_protos.rb
52
- homepage: https://github.com/segiddins/protobug/blob/v0.1.0/gen/protobug_well_known_protos
52
+ homepage: https://github.com/segiddins/protobug/blob/v0.2.0/gen/protobug_well_known_protos
53
53
  licenses:
54
54
  - Unlicense
55
55
  metadata:
56
56
  rubygems_mfa_required: 'true'
57
- post_install_message:
57
+ post_install_message:
58
58
  rdoc_options: []
59
59
  require_paths:
60
60
  - lib
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubygems_version: 3.5.9
73
- signing_key:
73
+ signing_key:
74
74
  specification_version: 4
75
75
  summary: Compiled protos for protobug from https://github.com/protocolbuffers/protobuf
76
76
  (well_known_protos)