class Formalist::Elements::CompoundField
Public Instance Methods
fill(input: {}, errors: {})
click to toggle source
Calls superclass method
Formalist::Element::fill
# File lib/formalist/elements/compound_field.rb, line 6 def fill(input: {}, errors: {}) children = self.children.map { |child| child.fill(input: input, errors: errors) } super(input: input, errors: errors, children: children) end
to_ast()
click to toggle source
Converts the compound field into an abstract syntax tree.
It takes the following format:
“‘
- :compound_field, [params]
-
“‘
With the following parameters:
-
Custom element type (or ‘:compound_field` otherwise)
-
Form
element attributes -
Child form elements
@see
Formalist::Element::Attributes#to_ast
“Form element attributes” structure@example
compound_field.to_ast # => [:compound_field, [ :content, :compound_field, [:object, []], [...child elements...], ]]
@return [Array] the compound field as an abstract syntax tree.
-
# File lib/formalist/elements/compound_field.rb, line 40 def to_ast [:compound_field, [ type, Element::Attributes.new(attributes).to_ast, children.map(&:to_ast), ]] end