Sha256: bb2cb918aa8be3915e756c02ec247dcc5efc741006ec0c0f0f7586957567161b

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

module ApiPack
  module Serializer
    module Parser
      module_function

      def serializer_hash(resource, klass, opt: {})
        adapter.serializer_hash(resource, klass, opt: opt)
      end

      def adapter
        return @adapter if @adapter

        self.adapter = :fast_json_api
        @adapter
      end

      def adapter=(adapter)
        require "./lib/api_pack/serializer/adapter/#{adapter}"

        adapter_name = adapter.to_s.split('_').collect(&:capitalize).join

        @adapter = Serializer::Adapter.const_get(adapter_name)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api_pack-1.0.0 lib/api_pack/serializer/parser.rb