Class: CARPS::Question
Overview
A question sent by the server, to be asked of the player.
Interacts with Answers class
Class Method Summary collapse
-
.parse(blob) ⇒ Object
Parse from the void.
Instance Method Summary collapse
-
#ask(answers) ⇒ Object
Ask the question, store the answer in the answers object.
-
#emit ⇒ Object
Emit.
-
#initialize(question) ⇒ Question
constructor
Create a question.
-
#preview ⇒ Object
Preview the question.
Methods inherited from Message
#crypt, #crypt=, #delete, #from, #from=, #parse, #path=, #save, #session, #session=
Constructor Details
#initialize(question) ⇒ Question
Create a question
35 36 37 |
# File 'lib/carps/mod/question.rb', line 35 def initialize question @text = question end |
Class Method Details
Instance Method Details
#ask(answers) ⇒ Object
Ask the question, store the answer in the answers object
51 52 53 54 |
# File 'lib/carps/mod/question.rb', line 51 def ask answers response = UI::question @text answers.answer @text, response end |
#emit ⇒ Object
Emit
46 47 48 |
# File 'lib/carps/mod/question.rb', line 46 def emit V.question @text end |
#preview ⇒ Object
Preview the question
57 58 59 |
# File 'lib/carps/mod/question.rb', line 57 def preview puts "Question: " + @text end |