Class: Quby::Questionnaires::Entities::Flag
- Inherits:
-
Struct
- Object
- Struct
- Quby::Questionnaires::Entities::Flag
- Defined in:
- lib/quby/questionnaires/entities/flag.rb
Instance Attribute Summary collapse
-
#default_in_interface ⇒ Object
Returns the value of attribute default_in_interface.
-
#depends_on ⇒ Object
Returns the value of attribute depends_on.
-
#description ⇒ Object
Returns the value of attribute description.
-
#description_false ⇒ Object
Returns the value of attribute description_false.
-
#description_true ⇒ Object
Returns the value of attribute description_true.
-
#hides_questions ⇒ Object
Returns the value of attribute hides_questions.
-
#internal ⇒ Object
Returns the value of attribute internal.
-
#key ⇒ Object
Returns the value of attribute key.
-
#shows_questions ⇒ Object
Returns the value of attribute shows_questions.
-
#trigger_on ⇒ Object
Returns the value of attribute trigger_on.
Instance Method Summary collapse
-
#if_triggered_by(answer_flags) ⇒ Object
rubocop:enable ParameterLists.
-
#initialize(key:, description_true: nil, description_false: nil, description: nil, internal: false, trigger_on: true, shows_questions: [], hides_questions: [], depends_on: nil, default_in_interface: nil) ⇒ Flag
constructor
rubocop:disable ParameterLists.
Constructor Details
#initialize(key:, description_true: nil, description_false: nil, description: nil, internal: false, trigger_on: true, shows_questions: [], hides_questions: [], depends_on: nil, default_in_interface: nil) ⇒ Flag
rubocop:disable ParameterLists
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 9 def initialize(key:, description_true: nil, description_false: nil, description: nil, internal: false, trigger_on: true, shows_questions: [], hides_questions: [], depends_on: nil, # used in interface to hide this flag unless the depended on flag is set to true default_in_interface: nil) # used in interface to set a default for the flag state, # does not have an effect outside of the interface super(key, description_true, description_false, description, internal, trigger_on, shows_questions, hides_questions, depends_on, default_in_interface) end |
Instance Attribute Details
#default_in_interface ⇒ Object
Returns the value of attribute default_in_interface
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def default_in_interface @default_in_interface end |
#depends_on ⇒ Object
Returns the value of attribute depends_on
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def depends_on @depends_on end |
#description ⇒ Object
Returns the value of attribute description
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def description @description end |
#description_false ⇒ Object
Returns the value of attribute description_false
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def description_false @description_false end |
#description_true ⇒ Object
Returns the value of attribute description_true
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def description_true @description_true end |
#hides_questions ⇒ Object
Returns the value of attribute hides_questions
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def hides_questions @hides_questions end |
#internal ⇒ Object
Returns the value of attribute internal
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def internal @internal end |
#key ⇒ Object
Returns the value of attribute key
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def key @key end |
#shows_questions ⇒ Object
Returns the value of attribute shows_questions
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def shows_questions @shows_questions end |
#trigger_on ⇒ Object
Returns the value of attribute trigger_on
6 7 8 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 6 def trigger_on @trigger_on end |
Instance Method Details
#if_triggered_by(answer_flags) ⇒ Object
rubocop:enable ParameterLists
25 26 27 |
# File 'lib/quby/questionnaires/entities/flag.rb', line 25 def if_triggered_by(answer_flags) yield if answer_flags[key] == trigger_on end |