Sha256: 9129d20a21237f1a68d300ad847fa5d47a4df1a81261a45b276b1e0dda3c1656

Contents?: true

Size: 677 Bytes

Versions: 5

Compression:

Stored size: 677 Bytes

Contents

module Skylight
  module Normalizers
    module ActiveModelSerializers
      class Render < Normalizer
        register "render.active_model_serializers"

        CAT = "view.render.active_model_serializers".freeze

        def normalize(trace, name, payload)
          serializer_class = payload[:serializer]

          title = serializer_class.name.sub(/^ActiveModel::(Serializer::)?/, '')

          if adapter_instance = payload[:adapter]
            adapter_name = adapter_instance.class.name.sub(/^ActiveModel::Serializer::Adapter::/, '')
            desc = "Adapter: #{adapter_name}"
          end

          [ CAT, title, desc ]
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
skylight-1.0.0.beta3 lib/skylight/normalizers/active_model_serializers/render.rb
skylight-0.10.3 lib/skylight/normalizers/active_model_serializers/render.rb
skylight-0.10.2 lib/skylight/normalizers/active_model_serializers/render.rb
skylight-1.0.0.beta2 lib/skylight/normalizers/active_model_serializers/render.rb
skylight-0.10.0 lib/skylight/normalizers/active_model_serializers/render.rb