Sha256: 43d7abcadd67c7eef377f8a00ec2a0267b6164213a6960a4b75162b6063bafc0

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

module Dry
  module Validation
    class InputProcessorCompiler::Sanitizer < InputProcessorCompiler
      PREDICATE_MAP = {
        default: 'string',
        none?: 'nil',
        bool?: 'bool',
        str?: 'string',
        int?: 'integer',
        float?: 'float',
        decimal?: 'decimal',
        date?: 'date',
        date_time?: 'date_time',
        time?: 'time',
        hash?: 'hash',
        array?: 'array'
      }.freeze

      CONST_MAP = {
        NilClass => 'nil',
        String => 'string',
        Integer => 'integer',
        Float => 'float',
        BigDecimal => 'decimal',
        Array => 'array',
        Hash => 'hash',
        Date => 'date',
        DateTime => 'date_time',
        Time => 'time',
        TrueClass => 'true',
        FalseClass => 'false'
      }.freeze

      def identifier
        :sanitizer
      end

      def hash_node(schema)
        [:hash, [:weak, schema, {}]]
      end

      def array_node(members)
        [:array, [members, {}]]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dry-validation-0.13.3 lib/dry/validation/input_processor_compiler/sanitizer.rb
dry-validation-0.13.2 lib/dry/validation/input_processor_compiler/sanitizer.rb
dry-validation-0.13.1 lib/dry/validation/input_processor_compiler/sanitizer.rb
dry-validation-0.12.3 lib/dry/validation/input_processor_compiler/sanitizer.rb
dry-validation-0.13.0 lib/dry/validation/input_processor_compiler/sanitizer.rb
dry-validation-0.12.2 lib/dry/validation/input_processor_compiler/sanitizer.rb
dry-validation-0.12.1 lib/dry/validation/input_processor_compiler/sanitizer.rb