Sha256: 6ff8db3b4e65c14c87e78b95bd0a0642f468559c3a79d528e7684169f43ef34a

Contents?: true

Size: 1.19 KB

Versions: 78

Compression:

Stored size: 1.19 KB

Contents

require 'yaml'

module VCR
  class Cassette
    class Serializers
      # The YAML serializer. This will use either Psych or Syck, which ever your
      # ruby interpreter defaults to. You can also force VCR to use Psych or Syck by
      # using one of those serializers.
      #
      # @see JSON
      # @see Psych
      # @see Syck
      module YAML
        extend self
        extend EncodingErrorHandling

        # @private
        ENCODING_ERRORS = [ArgumentError]

        # The file extension to use for this serializer.
        #
        # @return [String] "yml"
        def file_extension
          "yml"
        end

        # Serializes the given hash using YAML.
        #
        # @param [Hash] hash the object to serialize
        # @return [String] the YAML string
        def serialize(hash)
          handle_encoding_errors do
            ::YAML.dump(hash)
          end
        end

        # Deserializes the given string using YAML.
        #
        # @param [String] string the YAML string
        # @return [Hash] the deserialized object
        def deserialize(string)
          handle_encoding_errors do
            ::YAML.load(string)
          end
        end
      end
    end
  end
end

Version data entries

78 entries across 78 versions & 9 rubygems

Version Path
cloudsmith-api-2.0.16 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.15 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.14 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.13 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.12 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.11 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.10 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.9 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.8 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.7 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.6 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.5 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.4 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.3 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.2 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.1 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-2.0.0 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-1.142.3 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-1.120.3 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb
cloudsmith-api-1.61.3 vendor/bundle/ruby/2.6.0/gems/vcr-3.0.3/lib/vcr/cassette/serializers/yaml.rb