Class: Woody::Decorators::ChallengeQuestion
- Inherits:
-
Base
- Object
- Base
- Woody::Decorators::ChallengeQuestion
show all
- Defined in:
- lib/woody/decorators/challenge_question.rb
Instance Method Summary
collapse
Methods inherited from Base
#method_missing
Constructor Details
Returns a new instance of ChallengeQuestion.
6
7
8
9
|
# File 'lib/woody/decorators/challenge_question.rb', line 6
def initialize(model, answers)
super(model)
@answers = answers
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Woody::Decorators::Base
Instance Method Details
#answer ⇒ Object
11
12
13
14
|
# File 'lib/woody/decorators/challenge_question.rb', line 11
def answer
answer_item = answer_for_question(@model.id)
answer_item ? answer_item.answer : ""
end
|
#has_answer? ⇒ Boolean
16
17
18
|
# File 'lib/woody/decorators/challenge_question.rb', line 16
def has_answer?
answer_for_question(@model.id)
end
|
#number_type? ⇒ Boolean
28
29
30
|
# File 'lib/woody/decorators/challenge_question.rb', line 28
def number_type?
@model.type == "number"
end
|
#text_type? ⇒ Boolean
20
21
22
|
# File 'lib/woody/decorators/challenge_question.rb', line 20
def text_type?
@model.type == "text"
end
|
#textarea_type? ⇒ Boolean
24
25
26
|
# File 'lib/woody/decorators/challenge_question.rb', line 24
def textarea_type?
@model.type == "textarea"
end
|