Module: VCR::Cassette::Serializers::Syck

Extended by:
EncodingErrorHandling, Syck
Included in:
Syck
Defined in:
lib/vcr/cassette/serializers/syck.rb

Overview

The Syck serializer. Syck is the legacy YAML engine in ruby 1.8 and 1.9.

See Also:

Constant Summary collapse

ENCODING_ERRORS =
[ArgumentError]

Instance Method Summary collapse

Methods included from EncodingErrorHandling

handle_encoding_errors

Instance Method Details

#deserialize(string) ⇒ Hash

Deserializes the given string using Syck.

Parameters:

  • string (String)

    the YAML string

Returns:

  • (Hash)

    the deserialized object


39
40
41
42
43
# File 'lib/vcr/cassette/serializers/syck.rb', line 39

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

#file_extensionString

The file extension to use for this serializer.

Returns:

  • (String)

    “yml”


21
22
23
# File 'lib/vcr/cassette/serializers/syck.rb', line 21

def file_extension
  "yml"
end

#serialize(hash) ⇒ String

Serializes the given hash using Syck.

Parameters:

  • hash (Hash)

    the object to serialize

Returns:

  • (String)

    the YAML string


29
30
31
32
33
# File 'lib/vcr/cassette/serializers/syck.rb', line 29

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