Permalink
Browse files

Merge remote-tracking branch 'jeady/truefalse_fix'

  • Loading branch information...
2 parents 23504cc + 13bed88 commit 9a5030ecfbc049bc562d67287d998a1baf7547fb Richard Xia committed May 22, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/true_false.rb
View
@@ -1,11 +1,13 @@
class TrueFalse < Question
- def initialize(text, correct_answer, explanation=nil)
+ def initialize(text, correct_answer, opts=nil)
super
+ opts ||= {}
+ opts[:explanation] ||= ''
correct_answer = !!correct_answer # ensure 'true' or 'false' only
self.question_text = "True or False: #{text}"
self.answer correct_answer.to_s.capitalize
- self.distractor (!correct_answer).to_s.capitalize, :explanation => explanation
+ self.distractor (!correct_answer).to_s.capitalize, :explanation => opts[:explanation]
end
def multiple ; false ; end

0 comments on commit 9a5030e

Please sign in to comment.