Sha256: c5e800296944a64b2895629cd28f6c41e50af4ccaacc13cd7e890481b68e654f

Contents?: true

Size: 412 Bytes

Versions: 2

Compression:

Stored size: 412 Bytes

Contents

require 'yaml'

module SweatShop
  module Serializers
    class YamlSerializer < SweatShop::Serializer
      class << self
      
        def serialize(payload)
          if payload.respond_to?(:to_yaml)
            payload.to_yaml
          else
            YAML.dump(payload)
          end
        end
      
        def deserialize(payload)
          YAML.load(payload)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
netinlet-sweat_shop-1.1.0 lib/serializers/yaml_serializer.rb
netinlet-sweat_shop-1.1.1 lib/serializers/yaml_serializer.rb