Class: Wordwise::Question
- Inherits:
-
Object
- Object
- Wordwise::Question
- Defined in:
- lib/question.rb
Overview
Assemble a question consisting of a word and its definition shuffled with 3 other definitions.
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#def ⇒ Object
readonly
Returns the value of attribute def.
-
#defs ⇒ Object
readonly
Returns the value of attribute defs.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#word ⇒ Object
readonly
Returns the value of attribute word.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Question
constructor
Set instance variables for Question objects.
Constructor Details
#initialize ⇒ Question
Set instance variables for Question objects.
9 10 11 12 13 14 15 16 |
# File 'lib/question.rb', line 9 def initialize question_array = Wordwise::CLI.question_array @word = question_array[0][0] @def = question_array[1][0] @defs = question_array[1].shuffle @origin = question_array[2] @@all << self end |
Instance Attribute Details
#def ⇒ Object (readonly)
Returns the value of attribute def.
4 5 6 |
# File 'lib/question.rb', line 4 def def @def end |
#defs ⇒ Object (readonly)
Returns the value of attribute defs.
4 5 6 |
# File 'lib/question.rb', line 4 def defs @defs end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
4 5 6 |
# File 'lib/question.rb', line 4 def origin @origin end |
#word ⇒ Object (readonly)
Returns the value of attribute word.
4 5 6 |
# File 'lib/question.rb', line 4 def word @word end |
Class Method Details
.all ⇒ Object
18 19 20 |
# File 'lib/question.rb', line 18 def self.all @@all end |