Class: Chatpdf::Session::Question
- Inherits:
-
Object
- Object
- Chatpdf::Session::Question
- Defined in:
- lib/chatpdf/session/question.rb
Constant Summary collapse
- @@_id =
0
Instance Attribute Summary collapse
-
#answer ⇒ Object
Returns the value of attribute answer.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(question) ⇒ Question
constructor
A new instance of Question.
- #serialise ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(question) ⇒ Question
9 10 11 12 13 14 |
# File 'lib/chatpdf/session/question.rb', line 9 def initialize(question) @question = question @@_id = Random.uuid @id = @@_id @answer = nil end |
Instance Attribute Details
#answer ⇒ Object
Returns the value of attribute answer.
7 8 9 |
# File 'lib/chatpdf/session/question.rb', line 7 def answer @answer end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/chatpdf/session/question.rb', line 6 def id @id end |
Instance Method Details
#serialise ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/chatpdf/session/question.rb', line 20 def serialise { id: id, question: @question, answer: answer.serialise } end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/chatpdf/session/question.rb', line 16 def to_s @question end |