Class: Quby::Compiler::DSL::Questions::Base
- Inherits:
-
Base
- Object
- Base
- Quby::Compiler::DSL::Questions::Base
show all
- Defined in:
- lib/quby/compiler/dsl/questions/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
build
Methods included from Helpers
#check_question_keys_uniqueness, #image_alt, #image_tag, #video_tag
Constructor Details
#initialize(key, questionnaire:, **options) ⇒ Base
Returns a new instance of Base.
10
11
12
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 10
def initialize(key, questionnaire:, **options)
@questionnaire = questionnaire
end
|
Instance Attribute Details
#questionnaire ⇒ Object
Returns the value of attribute questionnaire.
8
9
10
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 8
def questionnaire
@questionnaire
end
|
Instance Method Details
#build ⇒ Object
14
15
16
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 14
def build
@question
end
|
#context_free_title(value) ⇒ Object
22
23
24
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 22
def context_free_title(value)
@question.context_free_title = value
end
|
#default_position(value) ⇒ Object
42
43
44
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 42
def default_position(value)
@question.default_position = value
end
|
#depends_on(keys) ⇒ Object
38
39
40
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 38
def depends_on(keys)
@question.set_depends_on(keys)
end
|
#description(value) ⇒ Object
26
27
28
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 26
def description(value)
@question.description = value
end
|
#hidden(value = true) ⇒ Object
34
35
36
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 34
def hidden(value = true)
@question.hidden = value
end
|
#presentation(value) ⇒ Object
30
31
32
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 30
def presentation(value)
@question.presentation = value
end
|
#title(value) ⇒ Object
18
19
20
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 18
def title(value)
@question.title = value
end
|
#validates_presence_of_answer(options = {}) ⇒ Object
TODO not referenced in definitions?
47
48
49
50
|
# File 'lib/quby/compiler/dsl/questions/base.rb', line 47
def validates_presence_of_answer(options = {})
@question.validations ||= []
@question.validations << {type: :requires_answer}.reverse_merge(options)
end
|