PHP 8.2.31
Preview: syck_hack.rb Size: 2.07 KB
//proc/thread-self/root/opt/alt/ruby20/lib64/ruby/2.0.0/rubygems/syck_hack.rb

# :stopdoc:

# Hack to handle syck's DefaultKey bug
#
# This file is always loaded AFTER either syck or psych are already
# loaded. It then looks at what constants are available and creates
# a consistent view on all rubys.
#
# All this is so that there is always a YAML::Syck::DefaultKey
# class no matter if the full yaml library has loaded or not.
#

module YAML
  # In newer 1.9.2, there is a Syck toplevel constant instead of it
  # being underneith YAML. If so, reference it back under YAML as
  # well.
  if defined? ::Syck
    # for tests that change YAML::ENGINE
    # 1.8 does not support the second argument to const_defined?
    remove_const :Syck rescue nil

    Syck = ::Syck

  # JRuby's "Syck" is called "Yecht"
  elsif defined? YAML::Yecht
    Syck = YAML::Yecht

  # Otherwise, if there is no YAML::Syck, then we've got just psych
  # loaded, so lets define a stub for DefaultKey.
  elsif !defined? YAML::Syck
    module Syck
      class DefaultKey
      end
    end
  end

  # Now that we've got something that is always here, define #to_s
  # so when code tries to use this, it at least just shows up like it
  # should.
  module Syck
    class DefaultKey
      remove_method :to_s rescue nil

      def to_s
        '='
      end
    end
  end

  SyntaxError = Error unless defined? SyntaxError
end

# Sometime in the 1.9 dev cycle, the Syck constant was moved from under YAML
# to be a toplevel constant. So gemspecs created under these versions of Syck
# will have references to Syck::DefaultKey.
#
# So we need to be sure that we reference Syck at the toplevel too so that
# we can always load these kind of gemspecs.
#
if !defined?(Syck)
  Syck = YAML::Syck
end

# Now that we've got Syck setup in all the right places, store
# a reference to the DefaultKey class inside Gem. We do this so that
# if later on YAML, etc are redefined, we've still got a consistent
# place to find the DefaultKey class for comparison.

module Gem
  # for tests that change YAML::ENGINE
  remove_const :SyckDefaultKey if const_defined? :SyckDefaultKey

  SyckDefaultKey = YAML::Syck::DefaultKey
end

# :startdoc:

Directory Contents

Dirs: 6 × Files: 53

Name Size Perms Modified Actions
commands DIR
- drwxr-xr-x 2024-03-03 22:43:42
Edit Download
core_ext DIR
- drwxr-xr-x 2024-03-03 22:43:42
Edit Download
ext DIR
- drwxr-xr-x 2024-03-03 22:43:42
Edit Download
package DIR
- drwxr-xr-x 2024-03-03 22:43:42
Edit Download
security DIR
- drwxr-xr-x 2024-03-03 22:43:42
Edit Download
ssl_certs DIR
- drwxr-xr-x 2024-03-03 22:43:42
Edit Download
1.56 KB lrw-r--r-- 2013-03-17 14:51:53
Edit Download
13.43 KB lrw-r--r-- 2012-11-30 16:27:52
Edit Download
5.27 KB lrw-r--r-- 2012-12-06 05:26:46
Edit Download
1.58 KB lrw-r--r-- 2013-02-05 21:06:14
Edit Download
11.82 KB lrw-r--r-- 2023-07-26 14:06:15
Edit Download
2.76 KB lrw-r--r-- 2013-07-22 16:33:18
Edit Download
7.74 KB lrw-r--r-- 2012-12-23 00:35:09
Edit Download
12.36 KB lrw-r--r-- 2013-11-13 02:59:08
Edit Download
5.53 KB lrw-r--r-- 2013-03-17 14:51:53
Edit Download
14.97 KB lrw-r--r-- 2013-07-22 16:33:18
Edit Download
1.73 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
2.86 KB lrw-r--r-- 2013-01-04 07:31:57
Edit Download
2.14 KB lrw-r--r-- 2013-07-22 16:33:18
Edit Download
2.70 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
416 B lrw-r--r-- 2012-12-10 00:40:39
Edit Download
2.84 KB lrw-r--r-- 2013-09-15 14:23:26
Edit Download
1.98 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
12.89 KB lrw-r--r-- 2012-12-06 05:26:46
Edit Download
22.19 KB lrw-r--r-- 2013-08-16 15:35:06
Edit Download
4.28 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
281 B lrw-r--r-- 2012-11-29 06:52:18
Edit Download
5.09 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
3.36 KB lrw-r--r-- 2011-07-27 01:40:07
Edit Download
1.35 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
1.96 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
13.22 KB lrw-r--r-- 2023-07-26 14:06:15
Edit Download
3.77 KB lrw-r--r-- 2013-08-16 15:35:06
Edit Download
1.58 KB lrw-r--r-- 2012-11-30 00:23:15
Edit Download
5.63 KB lrw-r--r-- 2013-07-22 16:33:18
Edit Download
249 B lrw-r--r-- 2013-07-25 15:42:22
Edit Download
763 B lrw-r--r-- 2013-07-22 16:33:18
Edit Download
7.75 KB lrw-r--r-- 2013-03-17 14:51:53
Edit Download
15.99 KB lrw-r--r-- 2015-08-18 13:01:02
Edit Download
3.67 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
6.02 KB lrw-r--r-- 2012-11-30 16:27:52
Edit Download
1.11 KB lrw-r--r-- 2023-07-26 14:06:15
Edit Download
20.56 KB lrw-r--r-- 2013-03-17 15:01:47
Edit Download
21.69 KB lrw-r--r-- 2013-10-26 17:44:33
Edit Download
3.12 KB lrw-r--r-- 2013-10-26 17:44:33
Edit Download
1.22 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
1.88 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
552 B lrw-r--r-- 2012-11-29 06:52:18
Edit Download
66.90 KB lrw-r--r-- 2023-07-26 14:06:15
Edit Download
5.17 KB lrw-r--r-- 2013-10-26 17:44:33
Edit Download
2.07 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
28.09 KB lrw-r--r-- 2013-07-25 15:42:22
Edit Download
4.03 KB lrw-r--r-- 2013-03-17 15:07:00
Edit Download
1.23 KB lrw-r--r-- 2011-07-27 01:40:07
Edit Download
8.29 KB lrw-r--r-- 2012-12-19 07:19:10
Edit Download
11.44 KB lrw-r--r-- 2012-11-29 06:52:18
Edit Download
4.08 KB lrw-r--r-- 2012-12-23 00:35:09
Edit Download
10.50 KB lrw-r--r-- 2013-10-26 17:44:33
Edit Download
1.59 KB lrw-r--r-- 2011-07-27 01:40:07
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).