Class: Question

Inherits:
Object
  • Object
show all
Defined in:
lib/kita/question.rb

Overview

Question Class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQuestion

Returns a new instance of Question.



10
11
12
13
# File 'lib/kita/question.rb', line 10

def initialize
  @hiragana = Hiragana.new
  @katakana = Katakana.new
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/kita/question.rb', line 8

def type
  @type
end

Instance Method Details

#new_questionObject



15
16
17
18
19
20
21
22
# File 'lib/kita/question.rb', line 15

def new_question
  question_types = []
  question_types.push @hiragana if Settings.hiragana
  question_types.push @katakana if Settings.katakana
  question = question_types.sample.question
  @type = question[:type]
  question
end