Sha256: 907ff8ae9408452ef3a728a2b0da60e54fb91c4390ec2f248881ea22e063df90

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

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

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

      def identifier
        :form
      end

      def hash_node(schema)
        [:type, ['form.hash', [:symbolized, schema]]]
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-validation-0.10.7 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.10.6 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.10.5 lib/dry/validation/input_processor_compiler/form.rb