Sha256: 80dfaf2114fa9daa83623b2b5fd3036a033078a09dcf43224b2d1e6273dcb84b

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

require 'dry/validation/input_processor_compiler'

module Dry
  module Validation
    class Schema
      def self.input_processor
        @input_processor ||=
          begin
            if type_map.is_a?(Dry::Types::Safe) && config.input_processor != :noop
              type_map
            elsif type_map.size > 0 && config.input_processor != :noop
              lookup_type("hash", config.input_processor)
                .public_send(config.hash_type, type_map)
            elsif input_processor_compiler
              input_processor_compiler.(rule_ast)
            else
              NOOP_INPUT_PROCESSOR
            end
          end
      end

      def self.input_processor_ast(type)
        config.input_processor_map.fetch(type).schema_ast(rule_ast)
      end

      def self.input_processor_compiler
        @input_processor_comp ||= config.input_processor_map[config.input_processor]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-validation-0.8.0 lib/dry/validation/schema/deprecated.rb