Class: Dry::Validation::InputProcessorCompiler::Sanitizer

Inherits:
Dry::Validation::InputProcessorCompiler show all
Defined in:
lib/dry/validation/input_processor_compiler/sanitizer.rb

Constant Summary collapse

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

Constants inherited from Dry::Validation::InputProcessorCompiler

DEFAULT_TYPE_NODE

Instance Attribute Summary

Attributes inherited from Dry::Validation::InputProcessorCompiler

#type_compiler

Instance Method Summary collapse

Methods inherited from Dry::Validation::InputProcessorCompiler

#call, #constructor, #initialize, #schema_ast, #type, #visit, #visit_and, #visit_each, #visit_implication, #visit_key, #visit_not, #visit_or, #visit_predicate, #visit_rule, #visit_schema, #visit_set, #visit_type, #visit_val

Constructor Details

This class inherits a constructor from Dry::Validation::InputProcessorCompiler

Instance Method Details

#array_node(members) ⇒ Object



42
43
44
# File 'lib/dry/validation/input_processor_compiler/sanitizer.rb', line 42

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

#hash_node(schema) ⇒ Object



38
39
40
# File 'lib/dry/validation/input_processor_compiler/sanitizer.rb', line 38

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

#identifierObject



34
35
36
# File 'lib/dry/validation/input_processor_compiler/sanitizer.rb', line 34

def identifier
  :sanitizer
end