Class: Quby::Questionnaires::DSL::Questions::Base
- Inherits:
-
Base
- Object
- Base
- Quby::Questionnaires::DSL::Questions::Base
show all
- Defined in:
- lib/quby/questionnaires/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, options = {}) ⇒ Base
Returns a new instance of Base.
13
14
15
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 13
def initialize(key, options = {})
@questionnaire = options[:questionnaire]
end
|
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
8
9
10
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 8
def key
@key
end
|
#questionnaire ⇒ Object
Returns the value of attribute questionnaire.
11
12
13
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 11
def questionnaire
@questionnaire
end
|
#title(value) ⇒ Object
Returns the value of attribute title.
9
10
11
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 9
def title
@title
end
|
#type ⇒ Object
Returns the value of attribute type.
10
11
12
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 10
def type
@type
end
|
Instance Method Details
#build ⇒ Object
17
18
19
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 17
def build
@question
end
|
#context_free_title(value) ⇒ Object
25
26
27
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 25
def context_free_title(value)
@question.context_free_title = value
end
|
#default_position(value) ⇒ Object
45
46
47
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 45
def default_position(value)
@question.default_position = value
end
|
#depends_on(keys) ⇒ Object
41
42
43
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 41
def depends_on(keys)
@question.set_depends_on(keys)
end
|
#description(value) ⇒ Object
29
30
31
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 29
def description(value)
@question.description = value
end
|
#hidden(value = true) ⇒ Object
37
38
39
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 37
def hidden(value = true)
@question.hidden = value
end
|
#presentation(value) ⇒ Object
33
34
35
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 33
def presentation(value)
@question.presentation = value
end
|
#validates_presence_of_answer(options = {}) ⇒ Object
49
50
51
52
|
# File 'lib/quby/questionnaires/dsl/questions/base.rb', line 49
def validates_presence_of_answer(options = {})
@question.validations ||= []
@question.validations << {type: :requires_answer}.reverse_merge(options)
end
|