psych 2.0.12 → 2.0.13
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 +4 -4
- data/CHANGELOG.rdoc +14 -0
- data/ext/psych/yaml/scanner.c +0 -7
- data/lib/psych.rb +1 -1
- data/lib/psych/visitors/to_ruby.rb +2 -2
- data/lib/psych/visitors/yaml_tree.rb +4 -3
- data/test/psych/helper.rb +7 -1
- data/test/psych/test_coder.rb +22 -0
- data/test/psych/test_to_yaml_properties.rb +1 -1
- data/test/psych/test_yaml.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98ff80d57bc20b6d84ee24df83966f0feebfbe3f
|
4
|
+
data.tar.gz: afa7e8005ce6e5ce2867e4c3d06793d94c2af627
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d219a2267fdb9c6471a9e27e18242e572bcbf259207d78b4a8948dd812fc1da23bde5b24850e099961c4d0384a71d2bb2177c02b8131d771d8c726924ec693f0
|
7
|
+
data.tar.gz: 0ae5569645a513442d8f7859b2ab3154a42c8fc728ec9a82f6a40971554eab5907338032352522755cc59666d13f58d42304f71aaacd6f86b5fc9c7c3f4f9dc9
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
Fri Feb 6 17:47:05 2015 Aaron Patterson <aaron@tenderlovemaking.com>
|
2
|
+
|
3
|
+
* ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
|
4
|
+
dumping objects with custom coders. [ruby-core:66215] [Bug #10496]
|
5
|
+
|
6
|
+
* test/psych/test_coder.rb: test for fix
|
7
|
+
|
8
|
+
Fri Feb 6 16:58:31 2015 Aaron Patterson <aaron@tenderlovemaking.com>
|
9
|
+
|
10
|
+
* ext/psych/lib/psych/visitors/to_ruby.rb: fix support for regular
|
11
|
+
expressions with newlines. tenderlove/psych#222
|
12
|
+
|
13
|
+
* test/psych/test_yaml.rb: test for change.
|
14
|
+
|
1
15
|
Thu Jan 29 02:34:27 2015 Aaron Patterson <aaron@tenderlovemaking.com>
|
2
16
|
|
3
17
|
* ext/psych/lib/psych/visitors/to_ruby.rb: fix parsing hashes with
|
data/ext/psych/yaml/scanner.c
CHANGED
@@ -1105,13 +1105,6 @@ yaml_parser_save_simple_key(yaml_parser_t *parser)
|
|
1105
1105
|
int required = (!parser->flow_level
|
1106
1106
|
&& parser->indent == (ptrdiff_t)parser->mark.column);
|
1107
1107
|
|
1108
|
-
/*
|
1109
|
-
* A simple key is required only when it is the first token in the current
|
1110
|
-
* line. Therefore it is always allowed. But we add a check anyway.
|
1111
|
-
*/
|
1112
|
-
|
1113
|
-
assert(parser->simple_key_allowed || !required); /* Impossible. */
|
1114
|
-
|
1115
1108
|
/*
|
1116
1109
|
* If the current position may start a simple key, save it.
|
1117
1110
|
*/
|
data/lib/psych.rb
CHANGED
@@ -32,7 +32,7 @@ module Psych
|
|
32
32
|
return result if @domain_types.empty? || !target.tag
|
33
33
|
|
34
34
|
key = target.tag.sub(/^[!\/]*/, '').sub(/(,\d+)\//, '\1:')
|
35
|
-
key = "tag:#{key}" unless key =~ /^(tag:|x-private)/
|
35
|
+
key = "tag:#{key}" unless key =~ /^(?:tag:|x-private)/
|
36
36
|
|
37
37
|
if @domain_types.key? key
|
38
38
|
value, block = @domain_types[key]
|
@@ -89,7 +89,7 @@ module Psych
|
|
89
89
|
Float(@ss.tokenize(o.value))
|
90
90
|
when "!ruby/regexp"
|
91
91
|
klass = class_loader.regexp
|
92
|
-
o.value =~ /^\/(.*)\/([mixn]*)$/
|
92
|
+
o.value =~ /^\/(.*)\/([mixn]*)$/m
|
93
93
|
source = $1
|
94
94
|
options = 0
|
95
95
|
lang = nil
|
@@ -21,6 +21,7 @@ module Psych
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def register target, node
|
24
|
+
return unless target.respond_to? :object_id
|
24
25
|
@targets << target
|
25
26
|
@obj_to_node[target.object_id] = node
|
26
27
|
end
|
@@ -566,10 +567,10 @@ module Psych
|
|
566
567
|
|
567
568
|
c = Psych::Coder.new(tag)
|
568
569
|
o.encode_with(c)
|
569
|
-
emit_coder c
|
570
|
+
emit_coder c, o
|
570
571
|
end
|
571
572
|
|
572
|
-
def emit_coder c
|
573
|
+
def emit_coder c, o
|
573
574
|
case c.type
|
574
575
|
when :scalar
|
575
576
|
@emitter.scalar c.scalar, nil, c.tag, c.tag.nil?, false, Nodes::Scalar::ANY
|
@@ -580,7 +581,7 @@ module Psych
|
|
580
581
|
end
|
581
582
|
@emitter.end_sequence
|
582
583
|
when :map
|
583
|
-
@emitter.start_mapping
|
584
|
+
register o, @emitter.start_mapping(nil, c.tag, c.implicit, c.style)
|
584
585
|
c.map.each do |k,v|
|
585
586
|
accept k
|
586
587
|
accept v
|
data/test/psych/helper.rb
CHANGED
@@ -5,7 +5,13 @@ require 'date'
|
|
5
5
|
require 'psych'
|
6
6
|
|
7
7
|
module Psych
|
8
|
-
|
8
|
+
superclass = if defined?(Minitest::Test)
|
9
|
+
Minitest::Test
|
10
|
+
else
|
11
|
+
MiniTest::Unit::TestCase
|
12
|
+
end
|
13
|
+
|
14
|
+
class TestCase < superclass
|
9
15
|
def self.suppress_warning
|
10
16
|
verbose, $VERBOSE = $VERBOSE, nil
|
11
17
|
yield
|
data/test/psych/test_coder.rb
CHANGED
@@ -95,6 +95,28 @@ module Psych
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
+
class Referential
|
99
|
+
attr_reader :a
|
100
|
+
|
101
|
+
def initialize
|
102
|
+
@a = self
|
103
|
+
end
|
104
|
+
|
105
|
+
def encode_with(c)
|
106
|
+
c['a'] = @a
|
107
|
+
end
|
108
|
+
|
109
|
+
def init_with(c)
|
110
|
+
@a = c['a']
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_self_referential
|
115
|
+
x = Referential.new
|
116
|
+
copy = Psych.load Psych.dump x
|
117
|
+
assert_equal copy, copy.a
|
118
|
+
end
|
119
|
+
|
98
120
|
def test_represent_with_object
|
99
121
|
thing = Psych.load(Psych.dump(RepresentWithObject.new))
|
100
122
|
assert_equal 20, thing
|
data/test/psych/test_yaml.rb
CHANGED
@@ -27,6 +27,10 @@ class Psych_Unit_Tests < Psych::TestCase
|
|
27
27
|
assert_match "2010-10-10 00:00:00.000000000 Z", yaml
|
28
28
|
end
|
29
29
|
|
30
|
+
def test_multiline_regexp
|
31
|
+
assert_cycle(Regexp.new("foo\nbar"))
|
32
|
+
end
|
33
|
+
|
30
34
|
# [ruby-core:34969]
|
31
35
|
def test_regexp_with_n
|
32
36
|
assert_cycle(Regexp.new('',0,'n'))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: psych
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|