Sha256: bad9e347b8bdb79e63f00988bc0c4077dedc14a426bc8795d5b92dc21143fe0a

Contents?: true

Size: 371 Bytes

Versions: 1

Compression:

Stored size: 371 Bytes

Contents

module Moneta
  module Api
    class KeyValueSerializer
      def self.serialize(entity)
        attributes = entity.properties

        attributes.collect do |property, _|
          value = entity.public_send(property)
          key = property.to_s.swapcase

          { 'key' => key, 'value' => value } unless value.nil?
        end.compact
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moneta-api-1.1.0 lib/moneta/api/key_value_serializer.rb