diff options
Diffstat (limited to 'lib/yaml.rb')
| -rw-r--r-- | lib/yaml.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/yaml.rb b/lib/yaml.rb index 0c33305e1d..c6f0f89fd2 100644 --- a/lib/yaml.rb +++ b/lib/yaml.rb @@ -1,13 +1,19 @@ # frozen_string_literal: false -## -# The YAML module is an alias of Psych, the YAML engine for Ruby. begin require 'psych' rescue LoadError - warn "#{caller[0]}:" - warn "It seems your ruby installation is missing psych (for YAML output)." - warn "To eliminate this warning, please install libyaml and reinstall your ruby." + case RUBY_ENGINE + when 'jruby' + warn "The Psych YAML extension failed to load.\n" \ + "Check your env for conflicting versions of SnakeYAML\n" \ + "See https://github.com/jruby/jruby/wiki/FAQs#why-does-the-psych-yaml-extension-fail-to-load-in-my-environment", + uplevel: 1 + else + warn "It seems your ruby installation is missing psych (for YAML output).\n" \ + "To eliminate this warning, please install libyaml and reinstall your ruby.\n", + uplevel: 1 + end raise end @@ -17,7 +23,7 @@ YAML = Psych # :nodoc: # # This module provides a Ruby interface for data serialization in YAML format. # -# The underlying implementation is the libyaml wrapper Psych. +# The YAML module is an alias of Psych, the YAML engine for Ruby. # # == Usage # @@ -31,6 +37,9 @@ YAML = Psych # :nodoc: # YAML.dump("foo") # => "--- foo\n...\n" # { :a => 'b'}.to_yaml # => "---\n:a: b\n" # +# As the implementation is provided by the Psych library, detailed documentation +# can be found in that library's docs (also part of standard library). +# # == Security # # Do not use YAML to load untrusted data. Doing so is unsafe and could allow @@ -39,7 +48,7 @@ YAML = Psych # :nodoc: # # == History # -# Syck was the original for YAML implementation in Ruby's standard library +# Syck was the original YAML implementation in Ruby's standard library # developed by why the lucky stiff. # # You can still use Syck, if you prefer, for parsing and emitting YAML, but you @@ -53,8 +62,10 @@ YAML = Psych # :nodoc: # For more advanced details on the implementation see Psych, and also check out # http://yaml.org for spec details and other helpful information. # -# Psych is maintained by Aaron Patterson on github: https://github.com/tenderlove/psych +# Psych is maintained by Aaron Patterson on github: https://github.com/ruby/psych # -# Syck can also be found on github: https://github.com/tenderlove/syck +# Syck can also be found on github: https://github.com/ruby/syck module YAML + # The version of YAML wrapper + LOADER_VERSION = "0.4.0" end |
