Sha256: 885785b8e1f351d35b2804d1f0c1f2b0ab367bb2275bb0826fbf99b280d2447e

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

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

      CONST_MAP = {
        NilClass => 'nil',
        String => 'string',
        Fixnum => 'int',
        Integer => 'int',
        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)
        [:type, ['hash', [:schema, schema]]]
      end

      def array_node(members)
        [:type, ['array', members]]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-validation-0.7.2 lib/dry/validation/input_processor_compiler/sanitizer.rb
dry-validation-0.7.1 lib/dry/validation/input_processor_compiler/sanitizer.rb
dry-validation-0.7.0 lib/dry/validation/input_processor_compiler/sanitizer.rb