Sha256: 2b20ddfe363dee0543fa650c98c6ccc58221405c47aae19c787e0c142df34f1f
Contents?: true
Size: 885 Bytes
Versions: 6
Compression:
Stored size: 885 Bytes
Contents
module Dry module Validation class Schema class Check < Value def class Check end def schema(other = nil, &block) schema = Schema.create_class(self, other, &block) if other schema.config.input_processor = other.class.config.input_processor end hash?.and(create_rule([:check, [name, schema.to_ast], [path]])) end private def method_missing(meth, *meth_args) vals, args = meth_args.partition { |arg| arg.class < DSL } keys = [name, *vals.map(&:name)] registry.ensure_valid_predicate(meth, args.size + keys.size, schema_class) predicate = registry[meth].curry(*args) rule = create_rule([:check, [name, predicate.to_ast, keys]]) add_rule(rule) rule end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems