Module: VCR::Cassette::Serializers::JSON
- Extended by:
- EncodingErrorHandling, JSON
- Included in:
- JSON
- Defined in:
- lib/vcr/cassette/serializers/json.rb
Overview
The JSON serializer. Uses ‘MultiJson` under the covers.
Constant Summary collapse
- ENCODING_ERRORS =
[ArgumentError]
Instance Method Summary collapse
-
#deserialize(string) ⇒ Hash
Deserializes the given string using ‘JSON`.
-
#file_extension ⇒ String
The file extension to use for this serializer.
-
#serialize(hash) ⇒ String
Serializes the given hash using ‘JSON`.
Methods included from EncodingErrorHandling
Instance Method Details
#deserialize(string) ⇒ Hash
Deserializes the given string using ‘JSON`.
40 41 42 43 44 |
# File 'lib/vcr/cassette/serializers/json.rb', line 40 def deserialize(string) handle_encoding_errors do ::JSON.parse(string) end end |
#file_extension ⇒ String
The file extension to use for this serializer.
22 23 24 |
# File 'lib/vcr/cassette/serializers/json.rb', line 22 def file_extension "json" end |
#serialize(hash) ⇒ String
Serializes the given hash using ‘JSON`.
30 31 32 33 34 |
# File 'lib/vcr/cassette/serializers/json.rb', line 30 def serialize(hash) handle_encoding_errors do ::JSON.generate(hash) end end |