Class: Formalist::ChildForms::ValidityCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/formalist/child_forms/validity_check.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(embedded_form_collection) ⇒ ValidityCheck

Returns a new instance of ValidityCheck.



9
10
11
# File 'lib/formalist/child_forms/validity_check.rb', line 9

def initialize(embedded_form_collection)
  @embedded_forms = embedded_form_collection
end

Instance Attribute Details

#embedded_formsObject (readonly)

Returns the value of attribute embedded_forms.



7
8
9
# File 'lib/formalist/child_forms/validity_check.rb', line 7

def embedded_forms
  @embedded_forms
end

Instance Method Details

#call(input) ⇒ Object Also known as: []



13
14
15
16
# 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