Sha256: 4878f38cdc87527e1fd8444bee3af9b3835493a6f5a48964bc746d12035d9bdf

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 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',
        Fixnum => 'form.int',
        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

12 entries across 12 versions & 1 rubygems

Version Path
dry-validation-0.10.4 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.10.3 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.10.2 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.10.1 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.10.0 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.9.5 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.9.4 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.9.3 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.9.2 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.9.1 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.9.0 lib/dry/validation/input_processor_compiler/form.rb
dry-validation-0.8.0 lib/dry/validation/input_processor_compiler/form.rb