Sha256: b8bd99071563fc9fb5756bec490480088fc3893f7302337116b0061b4cddcab9
Contents?: true
Size: 728 Bytes
Versions: 3
Compression:
Stored size: 728 Bytes
Contents
# typed: strict # frozen_string_literal: true module Paseto module Serializer module OptionalJson extend T::Sig extend Interface::Serializer sig { override.params(val: String, options: T::Hash[T.untyped, T.untyped]).returns(T.untyped) } def self.deserialize(val, options) obj = MultiJson.load(val, options) case obj when Hash then obj else val end rescue MultiJson::ParseError val end sig { override.params(val: T.untyped, options: T::Hash[T.untyped, T.untyped]).returns(String) } def self.serialize(val, options) return val unless val.is_a?(Hash) MultiJson.dump(val, options) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-paseto-0.1.2 | lib/paseto/serializer/optional_json.rb |
ruby-paseto-0.1.1 | lib/paseto/serializer/optional_json.rb |
ruby-paseto-0.1.0 | lib/paseto/serializer/optional_json.rb |