Module: VCR::Cassette::Serializers::YAML

Extended by:
EncodingErrorHandling, YAML
Included in:
YAML
Defined in:
lib/vcr/cassette/serializers/yaml.rb

Overview

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 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 YAML.



41
42
43
44
45
# File 'lib/vcr/cassette/serializers/yaml.rb', line 41

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

#file_extensionString

The file extension to use for this serializer.



23
24
25
# File 'lib/vcr/cassette/serializers/yaml.rb', line 23

def file_extension
  "yml"
end

#serialize(hash) ⇒ String

Serializes the given hash using YAML.



31
32
33
34
35
# File 'lib/vcr/cassette/serializers/yaml.rb', line 31

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