Class: TypedForm::FormData::FormSubmission
- Inherits:
-
Object
- Object
- TypedForm::FormData::FormSubmission
- Defined in:
- lib/typed_form/form_data/form_submission.rb
Overview
Takes an individual parsed response for a series of questions, and provides an interface for accessing the Question value objects.
Instance Attribute Summary collapse
-
#parsed_questions ⇒ Arendelle
readonly
Parsed Questions from JSON.
-
#parsed_response ⇒ Arendelle
readonly
Parsed Answers from JSON.
Instance Method Summary collapse
-
#initialize(parsed_questions:, parsed_response:) ⇒ FormSubmission
constructor
Creates a new Form Submission.
-
#questions ⇒ Array<Question>
Builds a full set of Question value objects with answer text.
Constructor Details
#initialize(parsed_questions:, parsed_response:) ⇒ FormSubmission
Creates a new Form Submission.
15 16 17 18 |
# File 'lib/typed_form/form_data/form_submission.rb', line 15 def initialize(parsed_questions:, parsed_response:) @parsed_questions = parsed_questions @parsed_response = parsed_response end |
Instance Attribute Details
#parsed_questions ⇒ Arendelle (readonly)
Parsed Questions from JSON
8 9 10 |
# File 'lib/typed_form/form_data/form_submission.rb', line 8 def parsed_questions @parsed_questions end |
#parsed_response ⇒ Arendelle (readonly)
Parsed Answers from JSON
8 9 10 |
# File 'lib/typed_form/form_data/form_submission.rb', line 8 def parsed_response @parsed_response end |
Instance Method Details
#questions ⇒ Array<Question>
Builds a full set of Question value objects with answer text.
22 23 24 25 26 |
# File 'lib/typed_form/form_data/form_submission.rb', line 22 def questions @_questions ||= Answers.collate(parsed_response: parsed_response, parsed_questions: parsed_questions, input_questions: input_questions) end |