psych 5.2.2-java → 5.2.4-java

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: cfd64ef73206772ded78ac380177121a32fd32e615ddec1a97e68dced1741612
4
- data.tar.gz: df99e64c76c815e6b4e5cdfbb4aebc6384b34149c7934e3108a70d16de56f11f
3
+ metadata.gz: 8a97e733fa3c4ea8606ef1f5288d033dcf27f4a488d74fe2124ee689c62f1f78
4
+ data.tar.gz: 577a281e8dcd0dd1cc2508eaab0b3145f490083e323966d3ca4695411e4ff6b0
5
5
  SHA512:
6
- metadata.gz: a9d355feba5224923015f9d0d8d9fa8f929196f73c8f218f7cd3745714fd46ac67e71819dad4049342b1012eaa035b14cbadf388f2ac74a14cd0b567e93eb794
7
- data.tar.gz: dc940e85cd7371b05069a3226903682824b533b13fa4dd58ebdbd04b2fb585495430d62f660b8b51c73985f52cc4fcfe3aafc9d1a0fb2de9f3d6e60a8d45110e
6
+ metadata.gz: 2cd02e8732496426e0a87dad9d4d631136bf7dfe48067e7b5541b9d90d53964367129e20a656a164a0008834585502939902fc4c3af8cbccb273cd8cc10e3238
7
+ data.tar.gz: 986ce2cc86e399c46f096a30cf8a87c9d3d6f3025f3a48e50bf3838f253b0f213d7f797db7d955d77d8a87a227dfcc8ac97a8baf19910be59c74fd4a539d48b0
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Psych
2
2
 
3
- * https://github.com/ruby/psych
4
- * https://docs.ruby-lang.org/en/master/Psych.html
3
+ * https://github.com/ruby/psych
4
+ * https://docs.ruby-lang.org/en/master/Psych.html
5
5
 
6
6
  ## Description
7
7
 
@@ -22,31 +22,38 @@ Psych.dump("foo") # => "--- foo\n...\n"
22
22
 
23
23
  ## Dependencies
24
24
 
25
- * libyaml
25
+ * libyaml
26
26
 
27
27
  ## Installation
28
28
 
29
29
  Psych has been included with MRI since 1.9.2, and is the default YAML parser
30
30
  in 1.9.3.
31
31
 
32
- If you want a newer gem release of Psych, you can use rubygems:
33
-
34
- gem install psych
32
+ If you want a newer gem release of Psych, you can use RubyGems:
35
33
 
34
+ ```bash
35
+ gem install psych
36
+ ```
36
37
 
37
38
  Psych supported the static build with specific version of libyaml sources. You can build psych with libyaml-0.2.5 like this.
38
39
 
39
- gem install psych -- --with-libyaml-source-dir=/path/to/libyaml-0.2.5
40
+ ```bash
41
+ gem install psych -- --with-libyaml-source-dir=/path/to/libyaml-0.2.5
42
+ ```
40
43
 
41
44
  In order to use the gem release in your app, and not the stdlib version,
42
45
  you'll need the following:
43
46
 
44
- gem 'psych'
45
- require 'psych'
47
+ ```ruby
48
+ gem 'psych'
49
+ require 'psych'
50
+ ```
46
51
 
47
52
  Or if you use Bundler add this to your `Gemfile`:
48
53
 
49
- gem 'psych'
54
+ ```ruby
55
+ gem 'psych'
56
+ ```
50
57
 
51
58
  JRuby ships with a pure Java implementation of Psych.
52
59
 
@@ -41,11 +41,15 @@ import org.jruby.runtime.Visibility;
41
41
  import org.jruby.runtime.builtin.IRubyObject;
42
42
  import org.jruby.runtime.load.Library;
43
43
 
44
+ import org.snakeyaml.engine.v2.common.SpecVersion;
45
+
44
46
  import java.io.IOException;
45
47
  import java.io.InputStream;
46
48
  import java.util.Properties;
47
49
 
48
50
  public class PsychLibrary implements Library {
51
+
52
+ private static final String POM_PROPERTIES = "META-INF/maven/org.snakeyaml/snakeyaml-engine/pom.properties";
49
53
  private static final String DUMMY_VERSION = "0.0";
50
54
 
51
55
  public void load(final Ruby runtime, boolean wrap) {
@@ -53,23 +57,23 @@ public class PsychLibrary implements Library {
53
57
 
54
58
  // load version from properties packed with the jar
55
59
  Properties props = new Properties();
56
- try( InputStream is = runtime.getJRubyClassLoader().getResourceAsStream("META-INF/maven/org.snakeyaml/snakeyaml-engine/pom.properties") ) {
57
- props.load(is);
60
+ try( InputStream is = SpecVersion.class.getResourceAsStream(POM_PROPERTIES) ) {
61
+ if (is != null) props.load(is);
58
62
  }
59
63
  catch( IOException e ) {
60
64
  // ignored
61
65
  }
62
66
  String snakeyamlVersion = props.getProperty("version", DUMMY_VERSION);
63
67
 
68
+ RubyString version = runtime.newString(snakeyamlVersion);
69
+ version.setFrozen(true);
70
+ psych.setConstant("SNAKEYAML_VERSION", version); // e.g. 2.10-SNAPSHOT
71
+
64
72
  if (snakeyamlVersion.endsWith("-SNAPSHOT")) {
65
73
  snakeyamlVersion = snakeyamlVersion.substring(0, snakeyamlVersion.length() - "-SNAPSHOT".length());
66
74
  }
67
75
 
68
- RubyString version = runtime.newString(snakeyamlVersion + ".0");
69
- version.setFrozen(true);
70
- psych.setConstant("SNAKEYAML_VERSION", version);
71
-
72
- String[] versionParts = version.toString().split("\\.");
76
+ String[] versionParts = (snakeyamlVersion + ".0").split("\\."); // 2.10-SNAPSHOT -> 2.10.0
73
77
  final RubyArray versionElements = runtime.newArray(runtime.newFixnum(Integer.parseInt(versionParts[0])), runtime.newFixnum(Integer.parseInt(versionParts[1])), runtime.newFixnum(Integer.parseInt(versionParts[2])));
74
78
  versionElements.setFrozen(true);
75
79
 
data/ext/psych/psych.c CHANGED
@@ -34,4 +34,3 @@ void Init_psych(void)
34
34
  Init_psych_to_ruby();
35
35
  Init_psych_yaml_tree();
36
36
  }
37
- /* vim: set noet sws=4 sw=4: */
@@ -587,4 +587,3 @@ void Init_psych_emitter(void)
587
587
  id_indentation = rb_intern("indentation");
588
588
  id_canonical = rb_intern("canonical");
589
589
  }
590
- /* vim: set noet sws=4 sw=4: */
@@ -562,4 +562,3 @@ void Init_psych_parser(void)
562
562
  id_end_mapping = rb_intern("end_mapping");
563
563
  id_event_location = rb_intern("event_location");
564
564
  }
565
- /* vim: set noet sws=4 sw=4: */
@@ -36,4 +36,3 @@ void Init_psych_to_ruby(void)
36
36
  rb_define_private_method(cPsychVisitorsToRuby, "build_exception", build_exception, 2);
37
37
  rb_define_private_method(class_loader, "path2class", path2class, 1);
38
38
  }
39
- /* vim: set noet sws=4 sw=4: */
@@ -9,4 +9,3 @@ void Init_psych_yaml_tree(void)
9
9
  VALUE visitor = rb_define_class_under(visitors, "Visitor", rb_cObject);
10
10
  cPsychVisitorsYamlTree = rb_define_class_under(visitors, "YAMLTree", visitor);
11
11
  }
12
- /* vim: set noet sws=4 sw=4: */
@@ -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,9 +2,9 @@
2
2
 
3
3
  module Psych
4
4
  # The version of Psych you are using
5
- VERSION = '5.2.2'
5
+ VERSION = '5.2.4'
6
6
 
7
7
  if RUBY_ENGINE == 'jruby'
8
- DEFAULT_SNAKEYAML_VERSION = '2.7'.freeze
8
+ DEFAULT_SNAKEYAML_VERSION = '2.9'.freeze
9
9
  end
10
10
  end
@@ -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,24 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.2
4
+ version: 5.2.4
5
5
  platform: java
6
6
  authors:
7
7
  - Aaron Patterson
8
8
  - SHIBATA Hiroshi
9
9
  - Charles Oliver Nutter
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2024-12-18 00:00:00.000000000 Z
12
+ date: 2025-05-01 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
15
+ name: jar-dependencies
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.1.7
21
- name: jar-dependencies
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,12 +26,12 @@ dependencies:
27
26
  - !ruby/object:Gem::Version
28
27
  version: 0.1.7
29
28
  - !ruby/object:Gem::Dependency
29
+ name: date
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
- name: date
36
35
  type: :runtime
37
36
  prerelease: false
38
37
  version_requirements: !ruby/object:Gem::Requirement
@@ -117,7 +116,6 @@ licenses:
117
116
  metadata:
118
117
  msys2_mingw_dependencies: libyaml
119
118
  changelog_uri: https://github.com/ruby/psych/releases
120
- post_install_message:
121
119
  rdoc_options:
122
120
  - "--main"
123
121
  - README.md
@@ -134,9 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
132
  - !ruby/object:Gem::Version
135
133
  version: '0'
136
134
  requirements:
137
- - jar org.snakeyaml:snakeyaml-engine, 2.7
138
- rubygems_version: 3.3.26
139
- signing_key:
135
+ - jar org.snakeyaml:snakeyaml-engine, 2.9
136
+ rubygems_version: 3.6.3
140
137
  specification_version: 4
141
138
  summary: Psych is a YAML parser and emitter
142
139
  test_files: []