Class: Question
- Inherits:
-
Object
- Object
- Question
- Defined in:
- lib/asker/ai/question.rb
Overview
Define Question class
Instance Attribute Summary collapse
-
#bads ⇒ Object
Returns the value of attribute bads.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#feedback ⇒ Object
Returns the value of attribute feedback.
-
#good ⇒ Object
Returns the value of attribute good.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#matching ⇒ Object
Returns the value of attribute matching.
-
#name ⇒ Object
Returns the value of attribute name.
-
#shorts ⇒ Object
Returns the value of attribute shorts.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#text ⇒ Object
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type = :choice) ⇒ Question
constructor
A new instance of Question.
- #reset(type = :choice) ⇒ Object
- #set_boolean ⇒ Object
- #set_choice ⇒ Object
- #set_match ⇒ Object
- #set_short ⇒ Object
- #shuffle? ⇒ Boolean
- #shuffle_off ⇒ Object
- #shuffle_on ⇒ Object
Constructor Details
#initialize(type = :choice) ⇒ Question
Returns a new instance of Question.
12 13 14 |
# File 'lib/asker/ai/question.rb', line 12 def initialize(type = :choice) reset(type) end |
Instance Attribute Details
#bads ⇒ Object
Returns the value of attribute bads.
7 8 9 |
# File 'lib/asker/ai/question.rb', line 7 def bads @bads end |
#comment ⇒ Object
Returns the value of attribute comment.
6 7 8 |
# File 'lib/asker/ai/question.rb', line 6 def comment @comment end |
#feedback ⇒ Object
Returns the value of attribute feedback.
8 9 10 |
# File 'lib/asker/ai/question.rb', line 8 def feedback @feedback end |
#good ⇒ Object
Returns the value of attribute good.
7 8 9 |
# File 'lib/asker/ai/question.rb', line 7 def good @good end |
#lang ⇒ Object
Returns the value of attribute lang.
10 11 12 |
# File 'lib/asker/ai/question.rb', line 10 def lang @lang end |
#matching ⇒ Object
Returns the value of attribute matching.
7 8 9 |
# File 'lib/asker/ai/question.rb', line 7 def matching @matching end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/asker/ai/question.rb', line 6 def name @name end |
#shorts ⇒ Object
Returns the value of attribute shorts.
7 8 9 |
# File 'lib/asker/ai/question.rb', line 7 def shorts @shorts end |
#tags ⇒ Object
Returns the value of attribute tags.
10 11 12 |
# File 'lib/asker/ai/question.rb', line 10 def @tags end |
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/asker/ai/question.rb', line 6 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/asker/ai/question.rb', line 9 def type @type end |
Instance Method Details
#reset(type = :choice) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/asker/ai/question.rb', line 16 def reset(type = :choice) @name = '' @comment = '' @text = '' @type = type @good = '' @bads = [] @matching = [] @shorts = [] @feedback = nil shuffle_on @tags = Set.new @lang = nil end |
#set_boolean ⇒ Object
39 40 41 |
# File 'lib/asker/ai/question.rb', line 39 def set_boolean @type = :boolean end |
#set_choice ⇒ Object
31 32 33 |
# File 'lib/asker/ai/question.rb', line 31 def set_choice @type = :choice end |
#set_match ⇒ Object
35 36 37 |
# File 'lib/asker/ai/question.rb', line 35 def set_match @type = :match end |
#set_short ⇒ Object
43 44 45 |
# File 'lib/asker/ai/question.rb', line 43 def set_short @type = :short end |
#shuffle? ⇒ Boolean
55 56 57 |
# File 'lib/asker/ai/question.rb', line 55 def shuffle? @shuffle end |
#shuffle_off ⇒ Object
47 48 49 |
# File 'lib/asker/ai/question.rb', line 47 def shuffle_off @shuffle = false end |
#shuffle_on ⇒ Object
51 52 53 |
# File 'lib/asker/ai/question.rb', line 51 def shuffle_on @shuffle = true end |