psych 5.2.3 → 5.2.4

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: e8c48b70d7c4ff53b1d536997a6e63173cb7e123e3f6e70f82c5de8596d93c4c
4
- data.tar.gz: c49d610314f1628a1e84267010dcfac5a076276eac2cad8dbbba9079ede9e08f
3
+ metadata.gz: 459c567be3d6ef6cb06cab52abb277a79f2f631da2944bd15622f23fdd3b1dec
4
+ data.tar.gz: 72aff05916df6027d69d9fe22562c5f5b700066f9d00670445450cdd2939ce4d
5
5
  SHA512:
6
- metadata.gz: 2d3d710995bfd6eb317994dd13024e5e3fd2967dbd379a1d510f86f7517177d2cc5e292a7d3b14c999071cc35ce625715ee3549fab90ce966567ba6e91f2475c
7
- data.tar.gz: f1570e565d5dd8c9e5984155dfbc1418a594aaa871fab7b7fabe62f05bc0a3e72ab141dd9f39c09689f8f4949a5c6e58fa9b1ca99c26db3552b0c9866a6032ad
6
+ metadata.gz: 87e6d5b1fa471069209207f4bca47d5b3158ce4d2909f18a497cb0b7b9b6d76e086553dc905e5b9fc92e5f620c1571db1db87531f8ba9fcbb2b685c12774d3df
7
+ data.tar.gz: d837ad140affbd97a8a6d4c6d7088d30f907cc0c5c7743367801b2fd8d2e8f0683f53a0e187541e6eee296b0c3fd5a69ad758b841e88548265e39a550eef29ef
@@ -17,3 +17,17 @@ end
17
17
  if defined?(::IRB)
18
18
  require_relative 'y'
19
19
  end
20
+
21
+
22
+ # TODO: how best to check for builtin Set?
23
+ if defined?(::Set) && Object.const_source_location(:Set) == ["ruby", 0]
24
+ class Set
25
+ def encode_with(coder)
26
+ coder["hash"] = to_h
27
+ end
28
+
29
+ def init_with(coder)
30
+ replace(coder["hash"].keys)
31
+ end
32
+ end
33
+ end
@@ -55,7 +55,8 @@ module Psych
55
55
  #
56
56
  # See also Psych::Visitors::Emitter
57
57
  def yaml io = nil, options = {}
58
- require "stringio"
58
+ require "stringio" unless defined?(StringIO)
59
+
59
60
  real_io = io || StringIO.new(''.encode('utf-8'))
60
61
 
61
62
  Visitors::Emitter.new(real_io, options).accept self
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Psych
4
4
  # The version of Psych you are using
5
- VERSION = '5.2.3'
5
+ VERSION = '5.2.4'
6
6
 
7
7
  if RUBY_ENGINE == 'jruby'
8
8
  DEFAULT_SNAKEYAML_VERSION = '2.9'.freeze
@@ -189,7 +189,8 @@ module Psych
189
189
  end
190
190
 
191
191
  def visit_Date o
192
- register o, visit_Integer(o.gregorian)
192
+ formatted = format_date o
193
+ register o, @emitter.scalar(formatted, nil, nil, true, false, Nodes::Scalar::ANY)
193
194
  end
194
195
 
195
196
  def visit_DateTime o
@@ -486,6 +487,10 @@ module Psych
486
487
  end
487
488
  end
488
489
 
490
+ def format_date date
491
+ date.strftime("%Y-%m-%d")
492
+ end
493
+
489
494
  def register target, yaml_obj
490
495
  @st.register target, yaml_obj
491
496
  yaml_obj
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: 5.2.3
4
+ version: 5.2.4
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: 2025-01-17 00:00:00.000000000 Z
13
+ date: 2025-05-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: stringio