Age | Commit message (Collapse) | Author |
|
In case where Psych is used as a two way serializers,
e.g. to serialize some cache or config, it is preferable
to have the same restrictions on both load and dump.
Otherwise you might dump and persist some objects payloads
that you later won't be able to read.
|
|
|
|
Using `compare_by_identity` gives a 4x performance boost on cache hits.
Benchmark in https://github.com/JuanitoFatas/fast-ruby/issues/189
|
|
The only remaining use of this function was to get the internal
message object from an exception's hidden `mesg` instance
variable to allow it to be dumped wiithout converting to a string.
As discussed in #103, this exposes internal implementation details
of CRuby, and ultimately does not provide any real utility to the
user since they can't directly inspect this hidden variable. The
test change here is to reflect CRuby behavior that denies equality
if the internal message objects do not match, as is the case after
the exception has been loaded and now has a simple String value.
The impact to users is that exceptions with special hidden message
objects will convert those objects to String during marshaling
through YAML. I believe this only affects NameError and its
descendants, since users can't set this field directly on their
own exception types.
Fixes #103.
|
|
When the Hash is revived, the ivars will be set before elements. This
is for the case when the hash setter depends on ivars set on the hash.
|
|
This commit allows exception backtraces to round trip
|
|
|
|
Dumping the backtrace for exceptions never worked, so lets remove it.
|
|
|
|
Fixes #324
|
|
|
|
Fixes #277
|
|
If a string is tagged as binary, then we should dump it as binary.
Fixes #278
|
|
|
|
Enable YAML serialization of Ruby delegators
|
|
|
|
|
|
|
|
|
|
|
|
Support YAML 1.2 Core Schema
|
|
ref. https://github.com/ruby/ruby/commit/778bbac8ac2ae50f0987c4888f7158296ee5bbdd
|
|
ref. https://github.com/ruby/ruby/commit/3e92b635fb5422207b7bbdc924e292e51e21f040
|
|
|
|
libyaml understands -1 as unlimited:
https://github.com/tenderlove/psych/blob/master/ext/psych/yaml/yaml.h#L1864
Raises on other negative values.
|
|
|
|
Fixes #241
|
|
dumping objects with custom coders. [ruby-core:66215] [Bug #10496]
* test/psych/test_coder.rb: test for fix
|
|
Anchors like `\Z` are not valid inside character class.
Use negative-lookahead instead.
|
|
With cf0dd2b93f1552a3c452a0bfa0e996f441d5e27e, fixes #217.
|
|
Fixes #216.
Fixes part of #217.
|
|
When no [chomping indicator][1] is specified for a folded or literal
block, then YAML parser should preserve the final line break (i.e. the
string should end with \n). This implies that when dumping a string
*without* the trailing newline to YAML, we should specify the stripping
indicator (-).
[1]: http://yaml.org/spec/1.2/2009-07-21/spec.html#id2593651
|
|
|
|
When psych parses YAML with string in the folded style as:
a: >
some
inline
content
and serializes it back to YAML,
then it renders the string in the literal style instead:
a: |
some inline content
This patch fixes this behaviour. When a string doesn't contain newlines
(blank line at the end is ignored) and it's not necessary to be quoted,
then it will use plain style or folded style according to its length and
the `line_width` option.
# line_width = 100
a: some inline content
# line_width = 11
a: >
some inline
content
This change was originally proposed by @Iazel.
|
|
|
|
* master: (21 commits)
* ext/psych/lib/psych/visitors/to_ruby.rb: call `allocate` on hash subclasses. Fixes github.com/tenderlove/psych/issues/196
* ext/psych/lib/psych/visitors/to_ruby.rb: revive hashes with ivars
removed isolate task
removed isolate plugin
added minitest dependency into gemspec
added install task into travis
added ruby-head env
bumping version to 2.0.8
fixed build error caused by trunk changes
bumping version to 2.0.7
merging from ruby trunk
backport r48512 from ruby/ruby trunk.
Add changelog for 2a4d9568f7d5d19c00231cf48eb855cc45ec3394
backport r48214 from ruby/ruby trunk.
Allow dumping any BasicObject that defines #marshal_dump or #marshal_load
bumping version
* ext/psych/lib/psych/visitors/yaml_tree.rb: fix NameError dumping and loading. Fixes GH #85. Thanks @brentdax for the patch! * test/psych/test_exception.rb: test for fix
* ext/psych/lib/psych/scalar_scanner.rb: fix loading strings that look like integers but have a newline. Fixes GH #189 * test/psych/test_string.rb: test for fix
* ext/psych/lib/psych/visitors/to_ruby.rb: merge keys with a hash should merge the hash in to the parent. * test/psych/test_merge_keys.rb: test for change. Fixes GH #202
* ext/psych/lib/psych/visitors/to_ruby.rb: quoted "<<" strings should not be treated as merge keys. * ext/psych/lib/psych/visitors/yaml_tree.rb: hashes with keys containing "<<" should roundtrip. * test/psych/test_merge_keys.rb: test for change. Fixes GH #203
...
Conflicts:
lib/psych/visitors/yaml_tree.rb
|
|
* ext/psych/lib/psych/visitors/yaml_tree.rb: dump hashes with ivars.
Fixes github.com/psych/issues/43
* test/psych/test_hash.rb: test for change
fixes #43
|
|
Additionally, it is assumed that these objects will have implemented
`respond_to?` and `class`, (e.g. SimpleDelegator). These assumptions are
reasonably inline with the assumptions of `Marshal` in regards to
`BasicObject`s.
|
|
loading. Fixes GH #85. Thanks @brentdax for the patch!
* test/psych/test_exception.rb: test for fix
fixes #85
|
|
should not be treated as merge keys.
* ext/psych/lib/psych/visitors/yaml_tree.rb: hashes with keys
containing "<<" should roundtrip.
* test/psych/test_merge_keys.rb: test for change. Fixes GH #203
fixes #203
|
|
|
|
serialization.
|
|
tag so that they can be parsed on input. [Bug #9873] [ruby-core:62825]
* test/psych/test_symbol.rb: test for change
|
|
objects.
* ext/psych/lib/psych/visitors/to_ruby.rb: support loading Encoding
objects.
* test/psych/test_encoding.rb: add test
* ext/psych/lib/psych.rb: add version
|
|
quotes should not have changed. [ruby-core:59316] [Bug #9300]
* ext/psych/lib/psych.rb: fixed missing require.
* test/psych/test_string.rb: test
|
|
|
|
Fixes #168
|
|
testing if a string is binary.
|
|
not be considered to be binary. Fixes Psych / GH 166
https://github.com/tenderlove/psych/issues/166
* test/psych/test_string.rb: test for fix
Fixes #166
|
|
strings start with special characters.
[Fixes GH-157] https://github.com/tenderlove/psych/issues/157
* test/psych/test_string.rb: test for change.
Fixes #157
|