Class: CARPS::Sheet::Character

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

Overview

Allow the dungeon master to inspect and modify character sheets

Supports syntactic and semantic verification

Direct Known Subclasses

Player

Instance Method Summary collapse

Constructor Details

#initialize(sheet = {}) ⇒ Character

Returns a new instance of Character.



29
30
31
# File 'lib/carps/mod/sheet/character.rb', line 29

def initialize sheet = {}
   @sheet = sheet
end

Instance Method Details

#[](attr) ⇒ Object

Access a value in the sheet



34
35
36
# File 'lib/carps/mod/sheet/character.rb', line 34

def [] attr
   @sheet[attr]
end

#[]=(attr, val) ⇒ Object

Set a value in the sheet



39
40
41
# File 'lib/carps/mod/sheet/character.rb', line 39

def []= attr, val
   @sheet[attr] = val
end

#attributesObject

Dump the attributes



44
45
46
# File 'lib/carps/mod/sheet/character.rb', line 44

def attributes
   @sheet
end

#emitObject

Emit



54
55
56
# File 'lib/carps/mod/sheet/character.rb', line 54

def emit
   @sheet.to_yaml
end

#empty?Boolean

The sheet has no entries - it is uninitialized!

Returns:

  • (Boolean)


49
50
51
# File 'lib/carps/mod/sheet/character.rb', line 49

def empty?
   @sheet.empty?
end