Sha256: fc126fbe8fb50a993ea6e4fa6c1d307e4572df9e54180361c573b8145e9f8912
Contents?: true
Size: 595 Bytes
Versions: 3
Compression:
Stored size: 595 Bytes
Contents
require "json" require_relative "builder" module Formalist module ChildForms class ValidityCheck attr_reader :embedded_forms def initialize(embedded_form_collection) @embedded_forms = embedded_form_collection end def call(input) return input if input.nil? input.map { |node| valid?(node) }.all? end alias_method :[], :call private def valid?(node) name, data = node.values_at(:name, :data) validation = embedded_forms[name].schema validation.(data).success? end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
formalist-0.9.0 | lib/formalist/child_forms/validity_check.rb |
formalist-0.8.0 | lib/formalist/child_forms/validity_check.rb |
formalist-0.7.0 | lib/formalist/child_forms/validity_check.rb |