Sha256: b3167180319e6edab217b50f1697eddb044ba28402c7c13c21fcf649b78bf948

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

require 'yaml'

module VCR
  class Cassette
    class Serializers
      module Syck
        extend self

        def file_extension
          "yml"
        end

        def serialize(hash)
          using_syck { ::YAML.dump(hash) }
        end

        def deserialize(string)
          using_syck { ::YAML.load(string) }
        end

        def using_syck
          return yield unless defined?(::YAML::ENGINE)
          original_engine = ::YAML::ENGINE.yamler
          ::YAML::ENGINE.yamler = 'syck'

          begin
            yield
          ensure
            ::YAML::ENGINE.yamler = original_engine
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vcr-2.0.0.rc1 lib/vcr/cassette/serializers/syck.rb
vcr-2.0.0.beta2 lib/vcr/cassette/serializers/syck.rb