Class: Question

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

Overview

Define Question class

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#badsObject

Returns the value of attribute bads.



7
8
9
# File 'lib/asker/ai/question.rb', line 7

def bads
  @bads
end

#commentObject

Returns the value of attribute comment.



6
7
8
# File 'lib/asker/ai/question.rb', line 6

def comment
  @comment
end

#feedbackObject

Returns the value of attribute feedback.



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

def feedback
  @feedback
end

#goodObject

Returns the value of attribute good.



7
8
9
# File 'lib/asker/ai/question.rb', line 7

def good
  @good
end

#langObject

Returns the value of attribute lang.



10
11
12
# File 'lib/asker/ai/question.rb', line 10

def lang
  @lang
end

#matchingObject

Returns the value of attribute matching.



7
8
9
# File 'lib/asker/ai/question.rb', line 7

def matching
  @matching
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/asker/ai/question.rb', line 6

def name
  @name
end

#shortsObject

Returns the value of attribute shorts.



7
8
9
# File 'lib/asker/ai/question.rb', line 7

def shorts
  @shorts
end

#tagsObject

Returns the value of attribute tags.



10
11
12
# File 'lib/asker/ai/question.rb', line 10

def tags
  @tags
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/asker/ai/question.rb', line 6

def text
  @text
end

#typeObject (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_booleanObject



39
40
41
# File 'lib/asker/ai/question.rb', line 39

def set_boolean
  @type = :boolean
end

#set_choiceObject



31
32
33
# File 'lib/asker/ai/question.rb', line 31

def set_choice
  @type = :choice
end

#set_matchObject



35
36
37
# File 'lib/asker/ai/question.rb', line 35

def set_match
  @type = :match
end

#set_shortObject



43
44
45
# File 'lib/asker/ai/question.rb', line 43

def set_short
  @type = :short
end

#shuffle?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/asker/ai/question.rb', line 55

def shuffle?
  @shuffle
end

#shuffle_offObject



47
48
49
# File 'lib/asker/ai/question.rb', line 47

def shuffle_off
  @shuffle = false
end

#shuffle_onObject



51
52
53
# File 'lib/asker/ai/question.rb', line 51

def shuffle_on
  @shuffle = true
end