Class: CARPS::ClientTurn
- Defined in:
- lib/carps/mod/client_turn.rb
Class Method Summary collapse
-
.parse(blob) ⇒ Object
Parse.
Instance Method Summary collapse
-
#emit ⇒ Object
Emit.
-
#initialize(sheet, status, questions) ⇒ ClientTurn
constructor
Create a client turn.
-
#preview ⇒ Object
Preview the turn.
-
#sheet ⇒ Object
Expose the character sheet.
-
#take ⇒ Object
Take the turn, return list of answers.
Methods inherited from Message
#crypt, #crypt=, #delete, #from, #from=, #parse, #path=, #save, #session, #session=
Constructor Details
#initialize(sheet, status, questions) ⇒ ClientTurn
Create a client turn
32 33 34 35 36 |
# File 'lib/carps/mod/client_turn.rb', line 32 def initialize sheet, status, questions @sheet = sheet @status = status @questions = questions end |
Class Method Details
.parse(blob) ⇒ Object
Parse
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/carps/mod/client_turn.rb', line 44 def ClientTurn.parse blob forget, blob = find K.client_turn, blob sheet, blob = Sheet::NewSheet.parse blob status, blob = StatusReport.parse blob more = true questions = [] while more begin que, blob = Question.parse blob questions.push que rescue Expected more = false end end [ClientTurn.new(sheet, status, questions), blob] end |
Instance Method Details
#emit ⇒ Object
Emit
62 63 64 65 66 |
# File 'lib/carps/mod/client_turn.rb', line 62 def emit question_text = (@questions.map {|q| q.emit}).join status = @status.emit K.client_turn + @sheet.emit + status + question_text end |
#preview ⇒ Object
Preview the turn
69 70 71 72 73 74 |
# File 'lib/carps/mod/client_turn.rb', line 69 def preview @status.display @questions.each do |q| q.preview end end |
#sheet ⇒ Object
Expose the character sheet
39 40 41 |
# File 'lib/carps/mod/client_turn.rb', line 39 def sheet @sheet end |