Sha256: 6e183bf0422db8c322273abe8cd8efb3a6637634b56c603aad6f3b5ebe0a38b9

Contents?: true

Size: 562 Bytes

Versions: 7

Compression:

Stored size: 562 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_relative "./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

7 entries across 7 versions & 1 rubygems

Version Path
api_pack-1.3.1 lib/api_pack/serializer/parser.rb
api_pack-1.2.1 lib/api_pack/serializer/parser.rb
api_pack-1.1.4 lib/api_pack/serializer/parser.rb
api_pack-1.1.3 lib/api_pack/serializer/parser.rb
api_pack-1.1.2 lib/api_pack/serializer/parser.rb
api_pack-1.1.1 lib/api_pack/serializer/parser.rb
api_pack-1.0.1 lib/api_pack/serializer/parser.rb