psych 4.0.4 → 4.0.5

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: c7feb4df24f58d2d6f2c8fb8d7ea5ab70f2c42a60b9abb8d3fb9196d0591ffe1
4
- data.tar.gz: 2f20dbfc2a70e7ee08d220a029c729e51aa4245318680cc65ec08ddba639894f
3
+ metadata.gz: 26a1c84ff74a4a009d098b2b6bb04f88f7fd04d1a86825a49f1050097fb13d48
4
+ data.tar.gz: 2a0eb7f061959a774cbb4233c556113b3f1652bbc4fe53ff50dce19fa7d984d9
5
5
  SHA512:
6
- metadata.gz: 517352bc229d00418119d8123457f692063f48a72663db1ec4daad04161dc84ad3ae6b15722ac63129f4b6cee2d324fc77c522ac463a4bd9ba664286ccdbb62f
7
- data.tar.gz: 87411fceb103e660919a5a58844e83e88209f805abd2109c8e3d6145736c41b27d85808ca9d454c51380c7d0cf1a6428937f85c81ef1cb2d47b10b7ef9720c7a
6
+ metadata.gz: 28a3cbc61def23b92423f71270f2683f732a128886e0886304ae02d361171549dc7840ff9b24f80b0545f18dd5138d70161d43c7b13801216c361d2f0d85e71e
7
+ data.tar.gz: f96b0451619e80161c74e4ffd9ca363cc03a645ff907d1dca940472f249e54690e4c9b38b8c51a9edd5a8a78c0a0634a826c368ed413103386ca36d5769e9f85
@@ -63,7 +63,7 @@ module Psych
63
63
  elsif string.match?(/^\d{4}-(?:1[012]|0\d|\d)-(?:[12]\d|3[01]|0\d|\d)$/)
64
64
  require 'date'
65
65
  begin
66
- class_loader.date.strptime(string, '%Y-%m-%d')
66
+ class_loader.date.strptime(string, '%F', Date::GREGORIAN)
67
67
  rescue ArgumentError
68
68
  string
69
69
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Psych
4
4
  # The version of Psych you are using
5
- VERSION = '4.0.4'
5
+ VERSION = '4.0.5'
6
6
 
7
7
  if RUBY_ENGINE == 'jruby'
8
- DEFAULT_SNAKEYAML_VERSION = '1.28'.freeze
8
+ DEFAULT_SNAKEYAML_VERSION = '1.31'.freeze
9
9
  end
10
10
  end
@@ -80,7 +80,9 @@ module Psych
80
80
  when "!ruby/object:DateTime"
81
81
  class_loader.date_time
82
82
  require 'date' unless defined? DateTime
83
- @ss.parse_time(o.value).to_datetime
83
+ t = @ss.parse_time(o.value)
84
+ DateTime.civil(*t.to_a[0, 6].reverse, Rational(t.utc_offset, 86400)) +
85
+ (t.subsec/86400)
84
86
  when '!ruby/encoding'
85
87
  ::Encoding.find o.value
86
88
  when "!ruby/object:Complex"
@@ -192,12 +192,13 @@ module Psych
192
192
  register o, @emitter.scalar(o.inspect, nil, '!ruby/regexp', false, false, Nodes::Scalar::ANY)
193
193
  end
194
194
 
195
+ def visit_Date o
196
+ register o, visit_Integer(o.gregorian)
197
+ end
198
+
195
199
  def visit_DateTime o
196
- formatted = if o.offset.zero?
197
- o.strftime("%Y-%m-%d %H:%M:%S.%9N Z".freeze)
198
- else
199
- o.strftime("%Y-%m-%d %H:%M:%S.%9N %:z".freeze)
200
- end
200
+ t = o.italy
201
+ formatted = format_time t, t.offset.zero?
201
202
  tag = '!ruby/object:DateTime'
202
203
  register o, @emitter.scalar(formatted, nil, tag, false, false, Nodes::Scalar::ANY)
203
204
  end
@@ -235,7 +236,6 @@ module Psych
235
236
  end
236
237
  alias :visit_TrueClass :visit_Integer
237
238
  alias :visit_FalseClass :visit_Integer
238
- alias :visit_Date :visit_Integer
239
239
 
240
240
  def visit_Float o
241
241
  if o.nan?
@@ -482,8 +482,8 @@ module Psych
482
482
  @emitter.end_mapping
483
483
  end
484
484
 
485
- def format_time time
486
- if time.utc?
485
+ def format_time time, utc = time.utc?
486
+ if utc
487
487
  time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
488
488
  else
489
489
  time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-05-16 00:00:00.000000000 Z
13
+ date: 2022-09-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: stringio