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.
Constant Summary collapse
- ENCODING_ERRORS =
[ArgumentError]
Instance Method Summary collapse
-
#deserialize(string) ⇒ Hash
Deserializes the given string using YAML.
-
#file_extension ⇒ String
The file extension to use for this serializer.
-
#serialize(hash) ⇒ String
Serializes the given hash using YAML.
Methods included from EncodingErrorHandling
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_extension ⇒ String
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 |