Class: CARPS::Sheet::Player

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

Overview

Player

The mod is an observer on the player. Hence when the player is updated, the mod can send the new character sheet via email

Instance Method Summary collapse

Methods inherited from Character

#[], #attributes, #emit, #empty?

Constructor Details

#initialize(mod, moniker, sheet = {}) ⇒ Player

Pass a sheet, the moniker used to refer to this sheet, and a reference to the mod



66
67
68
69
70
# File 'lib/carps/mod/sheet/character.rb', line 66

def initialize mod, moniker, sheet = {}
   super sheet
   @mod = mod
   @moniker = moniker
end

Instance Method Details

#[]=(attr, val) ⇒ Object

Update the sheet and notify the mod



73
74
75
76
# File 'lib/carps/mod/sheet/character.rb', line 73

def []= attr, val
   super
   @mod.sheet_updated @moniker
end