Class: Wizardry::Pages::QuestionPage
- Defined in:
- lib/wizardry/pages/question_page.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#next_pages ⇒ Object
Returns the value of attribute next_pages.
-
#questions ⇒ Object
Returns the value of attribute questions.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Page
Instance Method Summary collapse
-
#initialize(name, questions:, next_pages: {}, pages: [], title: nil, before_edit: nil, before_update: nil, after_update: nil) ⇒ QuestionPage
constructor
A new instance of QuestionPage.
- #question_names ⇒ Object
Methods inherited from Page
#after_update!, #before_edit!, #before_update!, #branch!, #branch?
Constructor Details
#initialize(name, questions:, next_pages: {}, pages: [], title: nil, before_edit: nil, before_update: nil, after_update: nil) ⇒ QuestionPage
Returns a new instance of QuestionPage.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/wizardry/pages/question_page.rb', line 6 def initialize(name, questions:, next_pages: {}, pages: [], title: nil, before_edit: nil, before_update: nil, after_update: nil) Rails.logger.debug("🧙 Adding page '#{name}' with #{questions&.size || 'no'} questions") @name = name @title = title || name.capitalize @questions = questions @next_pages = next_pages super(pages: pages, before_edit: before_edit, before_update: before_update, after_update: after_update) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/wizardry/pages/question_page.rb', line 4 def name @name end |
#next_pages ⇒ Object
Returns the value of attribute next_pages.
4 5 6 |
# File 'lib/wizardry/pages/question_page.rb', line 4 def next_pages @next_pages end |
#questions ⇒ Object
Returns the value of attribute questions.
4 5 6 |
# File 'lib/wizardry/pages/question_page.rb', line 4 def questions @questions end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/wizardry/pages/question_page.rb', line 4 def title @title end |
Instance Method Details
#question_names ⇒ Object
17 18 19 |
# File 'lib/wizardry/pages/question_page.rb', line 17 def question_names @questions.map(&:name) end |