Class: CARPS::Sheet::NewSheet

Inherits:
Message
  • Object
show all
Defined in:
lib/carps/mod/sheet/new_sheet.rb

Overview

A character sheet filled in by a user, sent across the net

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

#crypt, #crypt=, #delete, #from, #from=, #parse, #path=, #save, #session, #session=

Constructor Details

#initialize(sheet) ⇒ NewSheet

Write the sheet



38
39
40
# File 'lib/carps/mod/sheet/new_sheet.rb', line 38

def initialize sheet
   @sheet = sheet
end

Class Method Details

.parse(blob) ⇒ Object

Parse from the void



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/carps/mod/sheet/new_sheet.rb', line 43

def NewSheet.parse blob
   sheet, blob = find K.character_sheet, blob
   y = nil
   begin
      y = YAML.load sheet
   rescue ArgumentError => e
   end
   if y
      [NewSheet.new(y), blob]
   else
      raise Expected, "Expected valid YAML segment."
   end
end

Instance Method Details

#dumpObject

Dump the sheet!



63
64
65
# File 'lib/carps/mod/sheet/new_sheet.rb', line 63

def dump
   @sheet
end

#emitObject

Emit



58
59
60
# File 'lib/carps/mod/sheet/new_sheet.rb', line 58

def emit
   V.character_sheet @sheet.to_yaml
end