Class: CARPS::Sheet::Character
- Inherits:
-
Object
- Object
- CARPS::Sheet::Character
- 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
Instance Method Summary collapse
-
#[](attr) ⇒ Object
Access a value in the sheet.
-
#[]=(attr, val) ⇒ Object
Set a value in the sheet.
-
#attributes ⇒ Object
Dump the attributes.
-
#emit ⇒ Object
Emit.
-
#empty? ⇒ Boolean
The sheet has no entries - it is uninitialized!.
-
#initialize(sheet = {}) ⇒ Character
constructor
A new instance of Character.
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 |
#attributes ⇒ Object
Dump the attributes
44 45 46 |
# File 'lib/carps/mod/sheet/character.rb', line 44 def attributes @sheet end |
#emit ⇒ Object
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!
49 50 51 |
# File 'lib/carps/mod/sheet/character.rb', line 49 def empty? @sheet.empty? end |