diff options
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/psych/lib/psych/core_ext.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/psych/lib/psych/core_ext.rb b/ext/psych/lib/psych/core_ext.rb index 0721a133c3..950b20f2d6 100644 --- a/ext/psych/lib/psych/core_ext.rb +++ b/ext/psych/lib/psych/core_ext.rb @@ -17,3 +17,17 @@ end if defined?(::IRB) require_relative 'y' end + + +# TODO: how best to check for builtin Set? +if defined?(::Set) && Object.const_source_location(:Set) == ["ruby", 0] + class Set + def encode_with(coder) + coder["hash"] = to_h + end + + def init_with(coder) + replace(coder["hash"].keys) + end + end +end |
