class Formalist::ChildForms::ParamsProcessor
Attributes
embedded_forms[R]
Public Class Methods
new(embedded_form_collection)
click to toggle source
# File lib/formalist/child_forms/params_processor.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/params_processor.rb, line 13 def call(input) return input if input.nil? input.inject([]) { |output, node| output.push(process(node)) } end
Also aliased as: []
Private Instance Methods
process(node)
click to toggle source
# File lib/formalist/child_forms/params_processor.rb, line 21 def process(node) name, data = node.values_at(:name, :data) validation = embedded_forms[name].schema.(data) node.merge(data: validation.to_h) end