psych 4.0.4 → 4.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/psych/scalar_scanner.rb +1 -1
- data/lib/psych/versions.rb +2 -2
- data/lib/psych/visitors/to_ruby.rb +3 -1
- data/lib/psych/visitors/yaml_tree.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 247033480f351c6ed0affaedd3b76989d9b08cb72f9502a8ce90992f96ebc180
|
4
|
+
data.tar.gz: 55967241dfa777eaaa536c9bab3ab38df842b70107ba2d08e96a8f70196ee9e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1b85ec41b601fc614174a7bf2e43630b988eeb9cf771c4ecb1fadd1018a05a0b9962ac543a5f7441a3730d7b3f988acaf9a3530a063932f7d742ad6515278cf
|
7
|
+
data.tar.gz: 28bf4c4bb7cc8b2455d013226d915ddd84b2d75ac263eba35b852dd1b534bd4572b5104c3f5525b8c73a205f58d419042773d8693aeb9ebe60a50b8f3e077f0b
|
data/lib/psych/scalar_scanner.rb
CHANGED
@@ -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, '%
|
66
|
+
class_loader.date.strptime(string, '%F', Date::GREGORIAN)
|
67
67
|
rescue ArgumentError
|
68
68
|
string
|
69
69
|
end
|
data/lib/psych/versions.rb
CHANGED
@@ -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)
|
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
|
-
|
197
|
-
|
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
|
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
|
+
version: 4.0.6
|
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-
|
13
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: stringio
|