Class: Question
- Inherits:
-
Object
- Object
- Question
- Defined in:
- lib/asker/ai/question.rb
Constant Summary collapse
- TYPES =
%i[boolean choice ddmatch match ordering short]
Instance Attribute Summary collapse
-
#bads ⇒ Object
Bads answers (type: choice).
-
#comment ⇒ Object
Comments asociated.
-
#encode ⇒ Object
image base64 content used when export Moodle xml.
-
#feedback ⇒ Object
Question feedbak.
-
#good ⇒ Object
The correct answer (types: boolean, choice).
-
#lang ⇒ Object
Info used when export (YAML).
-
#matching ⇒ Object
Matching answers (type: match).
-
#name ⇒ Object
Question name used as identification.
-
#ordering ⇒ Object
Steps answer (type: ordering).
-
#shorts ⇒ Object
Short answers (type: short).
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#text ⇒ Object
The real text of the question.
-
#type ⇒ Object
readonly
Question type: ;boolean, :choice, :match, :short.
Instance Method Summary collapse
-
#initialize(type = :choice) ⇒ Question
constructor
A new instance of Question.
- #reset(type = :choice) ⇒ Object
- #shuffle? ⇒ Boolean
- #shuffle_off ⇒ Object
- #shuffle_on ⇒ Object
Constructor Details
#initialize(type = :choice) ⇒ Question
Returns a new instance of Question.
24 25 26 |
# File 'lib/asker/ai/question.rb', line 24 def initialize(type = :choice) reset(type) end |
Instance Attribute Details
#bads ⇒ Object
Bads answers (type: choice)
19 20 21 |
# File 'lib/asker/ai/question.rb', line 19 def bads @bads end |
#comment ⇒ Object
Comments asociated
9 10 11 |
# File 'lib/asker/ai/question.rb', line 9 def comment @comment end |
#encode ⇒ Object
image base64 content used when export Moodle xml
12 13 14 |
# File 'lib/asker/ai/question.rb', line 12 def encode @encode end |
#feedback ⇒ Object
Question feedbak
15 16 17 |
# File 'lib/asker/ai/question.rb', line 15 def feedback @feedback end |
#good ⇒ Object
The correct answer (types: boolean, choice)
18 19 20 |
# File 'lib/asker/ai/question.rb', line 18 def good @good end |
#lang ⇒ Object
Info used when export (YAML)
11 12 13 |
# File 'lib/asker/ai/question.rb', line 11 def lang @lang end |
#matching ⇒ Object
Matching answers (type: match)
20 21 22 |
# File 'lib/asker/ai/question.rb', line 20 def matching @matching end |
#name ⇒ Object
Question name used as identification
8 9 10 |
# File 'lib/asker/ai/question.rb', line 8 def name @name end |
#ordering ⇒ Object
Steps answer (type: ordering)
21 22 23 |
# File 'lib/asker/ai/question.rb', line 21 def ordering @ordering end |
#shorts ⇒ Object
Short answers (type: short)
22 23 24 |
# File 'lib/asker/ai/question.rb', line 22 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
The real text of the question
14 15 16 |
# File 'lib/asker/ai/question.rb', line 14 def text @text end |
#type ⇒ Object (readonly)
Question type: ;boolean, :choice, :match, :short
16 17 18 |
# File 'lib/asker/ai/question.rb', line 16 def type @type end |
Instance Method Details
#reset(type = :choice) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/asker/ai/question.rb', line 29 def reset(type = :choice) validate type @type = type @name = "" @comment = "" @tags = Set.new @lang = nil @encode = :none @text = "" @feedback = nil @good = "" @bads = [] @matching = [] @ordering = [] @shorts = [] shuffle_on end |
#shuffle? ⇒ Boolean
57 58 59 |
# File 'lib/asker/ai/question.rb', line 57 def shuffle? @shuffle end |
#shuffle_off ⇒ Object
49 50 51 |
# File 'lib/asker/ai/question.rb', line 49 def shuffle_off @shuffle = false end |
#shuffle_on ⇒ Object
53 54 55 |
# File 'lib/asker/ai/question.rb', line 53 def shuffle_on @shuffle = true end |