Class: Question
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Question
- Defined in:
- app/models/question.rb
Instance Method Summary collapse
- #default_args ⇒ Object
- #dependency_satisfied?(response_set) ⇒ Boolean
- #display_type ⇒ Object
- #has_dependency? ⇒ Boolean
-
#initialize(*args) ⇒ Question
constructor
Instance Methods.
- #mandatory? ⇒ Boolean
- #part_of_group? ⇒ Boolean
Constructor Details
#initialize(*args) ⇒ Question
Instance Methods
14 15 16 17 |
# File 'app/models/question.rb', line 14 def initialize(*args) super(*args) default_args end |
Instance Method Details
#default_args ⇒ Object
19 20 21 22 |
# File 'app/models/question.rb', line 19 def default_args # self.is_active ||= false self.is_mandatory ||= true end |
#dependency_satisfied?(response_set) ⇒ Boolean
36 37 38 |
# File 'app/models/question.rb', line 36 def dependency_satisfied?(response_set) self.has_dependency? and self.dependency.met?(response_set) end |
#display_type ⇒ Object
28 29 30 |
# File 'app/models/question.rb', line 28 def display_type super || "default" end |
#has_dependency? ⇒ Boolean
32 33 34 |
# File 'app/models/question.rb', line 32 def has_dependency? self.dependency != nil end |
#mandatory? ⇒ Boolean
24 25 26 |
# File 'app/models/question.rb', line 24 def mandatory? self.is_mandatory == true end |
#part_of_group? ⇒ Boolean
40 41 42 |
# File 'app/models/question.rb', line 40 def part_of_group? !self.question_group.nil? end |