Class: MetadataPresenter::ValidateAnswers

Inherits:
Object
  • Object
show all
Defined in:
app/validators/metadata_presenter/validate_answers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page_answers, components:, autocomplete_items:) ⇒ ValidateAnswers

Returns a new instance of ValidateAnswers.



5
6
7
8
9
# File 'app/validators/metadata_presenter/validate_answers.rb', line 5

def initialize(page_answers, components:, autocomplete_items:)
  @page_answers = page_answers
  @components = Array(components)
  @autocomplete_items = autocomplete_items
end

Instance Attribute Details

#autocomplete_itemsObject (readonly)

Returns the value of attribute autocomplete_items.



3
4
5
# File 'app/validators/metadata_presenter/validate_answers.rb', line 3

def autocomplete_items
  @autocomplete_items
end

#componentsObject (readonly)

Returns the value of attribute components.



3
4
5
# File 'app/validators/metadata_presenter/validate_answers.rb', line 3

def components
  @components
end

#page_answersObject (readonly)

Returns the value of attribute page_answers.



3
4
5
# File 'app/validators/metadata_presenter/validate_answers.rb', line 3

def page_answers
  @page_answers
end

Instance Method Details

#invalid?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/validators/metadata_presenter/validate_answers.rb', line 15

def invalid?
  !valid?
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/validators/metadata_presenter/validate_answers.rb', line 11

def valid?
  validators.map(&:valid?).all?
end