Sha256: 25173518a5044fb71bab738e703294d0b3bc8e9f11bcce873c135bb78b098a6c

Contents?: true

Size: 716 Bytes

Versions: 7

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

class Serega
  module SeregaValidations
    class CheckSerializeParams
      module InstanceMethods
        attr_reader :opts

        def initialize(opts)
          @opts = opts
        end

        def validate
          check_opts
        end

        private

        def check_opts
          Utils::CheckAllowedKeys.call(opts, serializer_class.config.serialize_keys)

          Utils::CheckOptIsHash.call(opts, :context)
          Utils::CheckOptIsBool.call(opts, :many)
        end

        def serializer_class
          self.class.serializer_class
        end
      end

      include InstanceMethods
      extend Serega::SeregaHelpers::SerializerClassHelper
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
serega-0.6.1 lib/serega/validations/check_serialize_params.rb
serega-0.6.0 lib/serega/validations/check_serialize_params.rb
serega-0.5.2 lib/serega/validations/check_serialize_params.rb
serega-0.5.1 lib/serega/validations/check_serialize_params.rb
serega-0.5.0 lib/serega/validations/check_serialize_params.rb
serega-0.4.0 lib/serega/validations/check_serialize_params.rb
serega-0.3.0 lib/serega/validations/check_serialize_params.rb