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