class Formalist::ChildForms::ValidityCheck
Attributes
embedded_forms[R]
Public Class Methods
new(embedded_form_collection)
click to toggle source
# File lib/formalist/child_forms/validity_check.rb, line 9 def initialize(embedded_form_collection) @embedded_forms = embedded_form_collection end
Public Instance Methods
call(input)
click to toggle source
# File lib/formalist/child_forms/validity_check.rb, line 13 def call(input) return input if input.nil? input.map { |node| valid?(node) }.all? end
Also aliased as: []
Private Instance Methods
valid?(node)
click to toggle source
# File lib/formalist/child_forms/validity_check.rb, line 21 def valid?(node) name, data = node.values_at(:name, :data) validation = embedded_forms[name].schema validation.(data).success? end