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

Extended by:
EncodingErrorHandling, Syck, VCR::Cassette::SyntaxErrorHandling
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]
SYNTAX_ERRORS =
[::Psych::SyntaxError]

Instance Method Summary collapse

Methods included from EncodingErrorHandling

handle_encoding_errors

Methods included from VCR::Cassette::SyntaxErrorHandling

handle_syntax_errors

Instance Method Details

#deserialize(string) ⇒ Hash

Deserializes the given string using Syck.

Parameters:

  • string (String)

    the YAML string

Returns:

  • (Hash)

    the deserialized object



43
44
45
46
47
48
49
# File 'lib/vcr/cassette/serializers/syck.rb', line 43

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

#file_extensionString

The file extension to use for this serializer.

Returns:

  • (String)

    “yml”



25
26
27
# File 'lib/vcr/cassette/serializers/syck.rb', line 25

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



33
34
35
36
37
# File 'lib/vcr/cassette/serializers/syck.rb', line 33

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