Sha256: 3a4c8e566a29a8e2f587b74141e3b4412204c6436ca9cbc3292b4d44d498f0aa

Contents?: true

Size: 447 Bytes

Versions: 4

Compression:

Stored size: 447 Bytes

Contents

# frozen_string_literal: true

class <%= @index_name %> < <%= @base_class %>
  module Serializers
    class <%= @type.camelize %>Serializer
      def initialize(<%= @type %>, **params)
        @entity = <%= @type %>
        @params = params
      end

      def to_h
        {
          id: entity.id, # This field is required
          name: entity.name,
        }
      end

      protected

      attr_reader :entity, :params
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
esse-0.2.0 lib/esse/cli/templates/type_serializer.rb.erb
esse-0.1.3 lib/esse/cli/templates/type_serializer.rb.erb
esse-0.1.2 lib/esse/cli/templates/type_serializer.rb.erb
esse-0.1.1 lib/esse/cli/templates/type_serializer.rb.erb