Sha256: d617f717e6e1a470dff9d805cc6196ee66a1971911515b388f067e70c511b3bf

Contents?: true

Size: 500 Bytes

Versions: 1

Compression:

Stored size: 500 Bytes

Contents

module SoberSwag
  module Serializer
    ##
    # Make a serialize of arrays out of a serializer of the elements
    class Array < Base
      def initialize(element_serializer)
        @element_serializer = element_serializer
      end

      attr_reader :element_serializer

      def serialize(object, options = {})
        object.map { |a| element_serializer.serialize(a, options) }
      end

      def type
        SoberSwag::Types::Array.of(element_serializer.type)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sober_swag-0.1.0 lib/sober_swag/serializer/array.rb