Sha256: dc5de50b6b13b54885bc45addc8b708ba34b689ef57c0b9e6abb679cf2aa2d9e
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true class Serega module SeregaValidations # # Validations of serializer initialization options # class CheckInitiateParams # # Validations of serializer initialization options instance methods # module InstanceMethods # @return [Hash] validated initialization options attr_reader :opts # # Initializes validator for initialization options # # @param opts [Hash] initialization options # # @return [void] # def initialize(opts) @opts = opts end # # Validates initiating params # def validate check_allowed_keys check_modifiers end private def check_allowed_keys Utils::CheckAllowedKeys.call(opts, serializer_class.config.initiate_keys) end def check_modifiers Initiate::CheckModifiers.call(serializer_class, opts[:only]) Initiate::CheckModifiers.call(serializer_class, opts[:except]) Initiate::CheckModifiers.call(serializer_class, opts[:with]) end def serializer_class self.class.serializer_class end end include InstanceMethods extend Serega::SeregaHelpers::SerializerClassHelper end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
serega-0.8.0 | lib/serega/validations/check_initiate_params.rb |
serega-0.7.0 | lib/serega/validations/check_initiate_params.rb |